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.

A114018 Least n-digit prime whose digit reversal is also prime.

Original entry on oeis.org

2, 11, 101, 1009, 10007, 100049, 1000033, 10000169, 100000007, 1000000007, 10000000207, 100000000237, 1000000000091, 10000000000313, 100000000000261, 1000000000000273, 10000000000000079, 100000000000000049, 1000000000000002901, 10000000000000000051
Offset: 1

Views

Author

Amarnath Murthy, Nov 12 2005

Keywords

Comments

The more compact version A168159 gives many more terms, cf. formula. [M. F. Hasler, Nov 21 2009]

Crossrefs

Cf. A168159, A007500, A006567, A122490. [M. F. Hasler, Nov 21 2009]

Programs

  • Mathematica
    f[n_] := Block[{k = 10^(n - 1)}, While[ !PrimeQ[k] || !PrimeQ[FromDigits@Reverse@IntegerDigits@k], k++ ]; k]; Array[f, 19] (* Robert G. Wilson v, Nov 19 2005 *)
    lndp[n_]:=Module[{p=NextPrime[10^n]},While[CompositeQ[IntegerReverse[ p]],p = NextPrime[ p]];p]; Array[lndp,20,0] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 05 2019 *)
  • PARI
    for(x=1,1e99, until( isprime(x=nextprime(x+1)) & isprime(eval(concat(vecextract(Vec(Str(x)),"-1..1")))),); print1(x", "); x=10^#Str(x)-1) \\ M. F. Hasler, Nov 21 2009
    
  • Python
    from sympy import isprime
    def c(n): return isprime(n) and isprime(int(str(n)[::-1]))
    def a(n): return next(p for p in range(10**(n-1), 10**n) if c(p))
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Jun 27 2022

Formula

a(n) = 10^(n-1) + A168159(n). [M. F. Hasler, Nov 21 2009]

Extensions

More terms from Robert G. Wilson v, Nov 19 2005