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.

Original entry on oeis.org

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

Views

Author

Robert G. Wilson v, Feb 06 2001

Keywords

Crossrefs

Cf. A059215.

Programs

  • 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 *)
  • 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