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.

A059706 Smallest prime p such that p^n reversed is a prime.

This page as a plain text file.
%I A059706 #11 Feb 19 2021 10:29:22
%S A059706 2,19,5,2,2,107,2,23,131,2,17,7,71,41,47,53,2,157,79,641,47,743,109,2,
%T A059706 19,5,1201,193,541,47,643,1231,3023,173,113,5,2,101,67,71,349,353,5,
%U A059706 53,2,709,163,677,4337,1327,919,769,317,23,2,503,1009,197,167,1663,23,37
%N A059706 Smallest prime p such that p^n reversed is a prime.
%t A059706 Do[ k = 2; While[ ! PrimeQ[ k ] || ! PrimeQ[ ToExpression[ StringReverse[ ToString[ k^n ] ] ] ], k++ ]; Print[ k ], {n, 1, 100} ]
%t A059706 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 *)
%o A059706 (Python)
%o A059706 from sympy import isprime, nextprime
%o A059706 def ok(p, n): return isprime(int(str(p**n)[::-1]))
%o A059706 def a(n):
%o A059706   p = 2
%o A059706   while not ok(p, n): p = nextprime(p)
%o A059706   return p
%o A059706 print([a(n) for n in range(1, 63)]) # _Michael S. Branicky_, Feb 19 2021
%Y A059706 Cf. A059215.
%K A059706 base,nonn
%O A059706 1,1
%A A059706 _Robert G. Wilson v_, Feb 06 2001