login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 


Distance of the least reversible n-digit prime from 10^(n-1)
2

%I #10 Jun 27 2022 11:13:01

%S 1,1,1,9,7,49,33,169,7,7,207,237,91,313,261,273,79,49,2901,51,441,193,

%T 9,531,289,1141,67,909,331,753,2613,657,49,4459,603,1531,849,2049,259,

%U 649,2119,1483,63,6747,519,3133,937,1159,1999,6921,2949,613,4137,1977,31

%N Distance of the least reversible n-digit prime from 10^(n-1)

%C A (much) more compact form of A114018 (cf. formula). Since this sequence and A114018 refer to "reversible primes" (A007500), while A122490 seems to use "emirps" (A006567), a(n+1) differs from A122490(n) iff 10^n+1 is prime <=> a(n+1)=1 <=> A114018(n)=10^n+1.

%H Michael S. Branicky, <a href="/A168159/b168159.txt">Table of n, a(n) for n = 1..500</a>

%F a(n)=A114018(n)-10^(n-1)

%t Table[p = NextPrime[y = 10^(n - 1)]; While[! PrimeQ[FromDigits[Reverse[IntegerDigits[p]]]], p = NextPrime[p]]; p - y, {n, 55}] (* _Jayanta Basu_, Aug 09 2013 *)

%o (PARI) for(x=1,1e99, until( isprime(x=nextprime(x+1)) & isprime(eval(concat(vecextract(Vec(Str(x)),"-1..1")))),);print1(x-10^ (#Str(x)-1),", "); x=10^#Str(x)-1)

%o (Python)

%o from sympy import isprime

%o def c(n): return isprime(n) and isprime(int(str(n)[::-1]))

%o def a(n): return next(p-10**(n-1) for p in range(10**(n-1), 10**n) if c(p))

%o print([a(n) for n in range(1, 56)]) # _Michael S. Branicky_, Jun 27 2022

%K base,nonn

%O 1,4

%A _M. F. Hasler_, Nov 21 2009

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 22 07:28 EDT 2024. Contains 376097 sequences. (Running on oeis4.)