OFFSET
1,1
COMMENTS
10886968801 is the least palindromic prime of this sequence for which the set of digits is {0,1,6,8,9}.
Terms must start and end with digit 1 and be of odd length for n > 1. - Michael S. Branicky, Feb 19 2024
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..16934 (all terms < 10^20)
Carlos Rivera, Puzzle 1163. Palindromic primes that are semiprimes when turned upside down, The Prime Puzzles & Problems Connection.
EXAMPLE
16661 becomes 19991 under such a rotation, and both are palindromic primes.
PROG
(PARI) rot(u)=my(v=[]); for(i=1, #u, my(x=u[i]); if(x==6, v=concat(9, v), x==9, v=concat(6, v), vecsearch([0, 1, 8], x)>0, v=concat(x, v))); v
is(x)=my(u=digits(x), su=Set(u)); if(setintersect(su, Set([0, 1, 6, 8, 9]))!=su||!isprime(x)||Vecrev(u)!=u, return(0)); my(y=fromdigits(rot(u))); return(isprime(y))
(Python)
from sympy import isprime
from itertools import product, count, islice
def flip180(s): return s[::-1].translate({54:57, 57:54})
def agen(): # generator of terms
yield 11
for digits in count(3, 2):
for rest in product("01689", repeat=digits//2-1):
for mid in "01689":
s = "".join(("1", )+rest+(mid, )+rest[::-1]+("1", ))
if isprime(t:=int(s)) and isprime(int(flip180(s))):
yield t
print(list(islice(agen(), 28))) # Michael S. Branicky, Feb 19 2024
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jean-Marc Rebert, Feb 18 2024
STATUS
approved