cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A158214 Smallest palindromic prime made up of 0's and k 1's, where k = A007310(n), odd numbers not divisible by 3.

Original entry on oeis.org

100111001, 110111011, 1110111110111, 10111101110111101, 100111111111111111001, 1111111111111111111, 11111111111111111111111, 10111111111101110111111111101, 1111110111111111111111110111111
Offset: 2

Views

Author

Lekraj Beedassy, Mar 13 2009

Keywords

Comments

Smallest palindromic prime with digit sum A007310(n) and using only 0's and 1's.

Crossrefs

Cf. A020449.

Programs

  • Python
    from _future_ import division
    from sympy.utilities.iterables import multiset_permutations
    from sympy import isprime
    A158214_list = []
    for i in range(2,101):
        if i % 6 == 1 or i % 6 == 5:
            i2 = i//2
            l = i2
            flag = True
            while flag:
                dlist = '0'*(l-i2) + '1'*i2
                for d in multiset_permutations(dlist):
                    s = ''.join(d)
                    n = int(s+'1'+s[::-1])
                    if isprime(n):
                        A158214_list.append(n)
                        flag = False
                        break
                else:
                    l += 1 # Chai Wah Wu, Dec 17 2015