login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A059706
Smallest prime p such that p^n reversed is a prime.
1
2, 19, 5, 2, 2, 107, 2, 23, 131, 2, 17, 7, 71, 41, 47, 53, 2, 157, 79, 641, 47, 743, 109, 2, 19, 5, 1201, 193, 541, 47, 643, 1231, 3023, 173, 113, 5, 2, 101, 67, 71, 349, 353, 5, 53, 2, 709, 163, 677, 4337, 1327, 919, 769, 317, 23, 2, 503, 1009, 197, 167, 1663, 23, 37
OFFSET
1,1
MATHEMATICA
Do[ k = 2; While[ ! PrimeQ[ k ] || ! PrimeQ[ ToExpression[ StringReverse[ ToString[ k^n ] ] ] ], k++ ]; Print[ k ], {n, 1, 100} ]
sprp[n_]:=Module[{p=2}, While[CompositeQ[IntegerReverse[p^n]], p= NextPrime[ p]]; p]; Array[sprp, 70] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Aug 28 2019 *)
PROG
(Python)
from sympy import isprime, nextprime
def ok(p, n): return isprime(int(str(p**n)[::-1]))
def a(n):
p = 2
while not ok(p, n): p = nextprime(p)
return p
print([a(n) for n in range(1, 63)]) # Michael S. Branicky, Feb 19 2021
CROSSREFS
Cf. A059215.
Sequence in context: A354207 A358980 A092120 * A370387 A128361 A096481
KEYWORD
base,nonn
AUTHOR
Robert G. Wilson v, Feb 06 2001
STATUS
approved