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.

This page as a plain text file.
%I A114018 #21 Jun 27 2022 11:12:01
%S A114018 2,11,101,1009,10007,100049,1000033,10000169,100000007,1000000007,
%T A114018 10000000207,100000000237,1000000000091,10000000000313,
%U A114018 100000000000261,1000000000000273,10000000000000079,100000000000000049,1000000000000002901,10000000000000000051
%N A114018 Least n-digit prime whose digit reversal is also prime.
%C A114018 The more compact version A168159 gives many more terms, cf. formula. [_M. F. Hasler_, Nov 21 2009]
%H A114018 Michael S. Branicky, <a href="/A114018/b114018.txt">Table of n, a(n) for n = 1..500</a> (terms 1..100 from Harvey P. Dale)
%F A114018 a(n) = 10^(n-1) + A168159(n). [_M. F. Hasler_, Nov 21 2009]
%t A114018 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 *)
%t A114018 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 *)
%o A114018 (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
%o A114018 (Python)
%o A114018 from sympy import isprime
%o A114018 def c(n): return isprime(n) and isprime(int(str(n)[::-1]))
%o A114018 def a(n): return next(p for p in range(10**(n-1), 10**n) if c(p))
%o A114018 print([a(n) for n in range(1, 21)]) # _Michael S. Branicky_, Jun 27 2022
%Y A114018 Cf. A168159, A007500, A006567, A122490. [_M. F. Hasler_, Nov 21 2009]
%K A114018 base,nonn
%O A114018 1,1
%A A114018 _Amarnath Murthy_, Nov 12 2005
%E A114018 More terms from _Robert G. Wilson v_, Nov 19 2005