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.

A114019 Largest n-digit prime whose digit reversal is also prime.

Original entry on oeis.org

7, 97, 991, 9967, 99989, 999983, 9999971, 99999827, 999999893, 9999999967, 99999999977, 999999999959, 9999999999799, 99999999999959, 999999999999877, 9999999999999571, 99999999999997997, 999999999999999737, 9999999999999999719, 99999999999999999631
Offset: 1

Views

Author

Amarnath Murthy, Nov 12 2005

Keywords

Crossrefs

Cf. A113018.

Programs

  • Mathematica
    f[n_] := Block[{k = 10^n}, While[ !PrimeQ[k] || !PrimeQ[FromDigits@Reverse@IntegerDigits@k], k-- ]; k]; Array[f, 19] (* Robert G. Wilson v, Nov 19 2005 *)
    Table[Module[{p=NextPrime[10^e,-1]},While[CompositeQ[IntegerReverse[p]],p=NextPrime[p,-1]];p],{e,20}] (* Harvey P. Dale, Mar 01 2025 *)
  • 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-1), -2) if c(p))
    print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Jun 27 2022

Extensions

More terms from Robert G. Wilson v, Nov 19 2005
a(19) and beyond from Michael S. Branicky, Jun 27 2022