OFFSET
1,1
COMMENTS
LINKS
Karl-Heinz Hofmann, Table of n, a(n) for n = 1..10000
EXAMPLE
113 and 311 are distinct primes, and 3 (number of digits) and 5 (1+1+3) are also primes.
PROG
(PARI) sod(n)=my(s=0); while(n>9, s+=n%10; n\=10); s+n
R(n)=my(v=eval(Vec(Str(n))), s=0); forstep(i=#v, 1, -1, s=10*s+v[i]); s
isA167631(n)=my(r); isprime(#Str(n)) && isprime(sod(n)) && isprime(n) && isprime(r=R(n)) && n!=r \\ Charles R Greathouse IV, Nov 10 2009
(Python)
from sympy import primerange, isprime
A167631 =[]
for power_of_ten in [2, 3, 5]: # (7 can be added (12 sec. and 26790 terms), 11 not recommended)
primes = list(primerange(10**(power_of_ten-1), 10**power_of_ten))
for p in primes:
if str(p) != (p_rev:=str(p)[::-1]):
if isprime(int(p_rev)):
if isprime(sum(list(map(int, p_rev.strip())))): A167631.append(p)
print(A167631) # Karl-Heinz Hofmann, Feb 19 2025
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Claudio Meller, Nov 07 2009
EXTENSIONS
Edited by Charles R Greathouse IV and R. J. Mathar, Nov 10 2009
STATUS
approved