OFFSET
1,4
COMMENTS
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..500
FORMULA
a(n)=A114018(n)-10^(n-1)
MATHEMATICA
Table[p = NextPrime[y = 10^(n - 1)]; While[! PrimeQ[FromDigits[Reverse[IntegerDigits[p]]]], p = NextPrime[p]]; p - y, {n, 55}] (* Jayanta Basu, Aug 09 2013 *)
PROG
(PARI) for(x=1, 1e99, until( isprime(x=nextprime(x+1)) & isprime(eval(concat(vecextract(Vec(Str(x)), "-1..1")))), ); print1(x-10^ (#Str(x)-1), ", "); x=10^#Str(x)-1)
(Python)
from sympy import isprime
def c(n): return isprime(n) and isprime(int(str(n)[::-1]))
def a(n): return next(p-10**(n-1) for p in range(10**(n-1), 10**n) if c(p))
print([a(n) for n in range(1, 56)]) # Michael S. Branicky, Jun 27 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
M. F. Hasler, Nov 21 2009
STATUS
approved