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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A114017 a(n) = smallest n-digit prime which differs from the previous n-digit prime at every corresponding digit (or 0 if no such prime exists). 1

%I #14 Aug 17 2017 22:33:30

%S 3,23,211,2003,20011,200003,3000017,20000003,200000033,2000000011,

%T 20000000089,300000000077,2000000000003,20000000000021,

%U 400000000000063,2000000000000021,50000000000000051,200000000000000003

%N a(n) = smallest n-digit prime which differs from the previous n-digit prime at every corresponding digit (or 0 if no such prime exists).

%C For n > 1, a(n), if it exists, is of the form nextprime(t*10^(n-1)) for some t, 2 <= t <= 9. [_Max Alekseyev_, Apr 23 2010]

%e 2003 is a term as the previous prime 1999 differs at every corresponding position (1,2), (9,0), (9,0), (9,3).

%t Table[SelectFirst[Partition[Prime@ Range[PrimePi@ NextPrime[10^n], PrimePi[10^(n + 1) - 1]], 2, 1], AllTrue[Transpose@ {IntegerDigits[#1], IntegerDigits[#2]}, UnsameQ @@ # &] & @@ # &], {n, 0, 7}] [[All, -1]] (* _Michael De Vlieger_, Aug 14 2017 *)

%o (PARI) { a(n) = local(L,U,aa,bb); if(n==1, return(3)); for(t=2,9, L=precprime(t*10^(n-1)); U=nextprime(t*10^(n-1)); aa=Vec(Str(L)); bb=Vec(Str(U)); if(sum(i=1,#aa,aa[i]!=bb[i])==#aa,return(U)); ); 0 } \\ _Max Alekseyev_, Apr 23 2010

%Y Cf. A114016.

%K base,nonn

%O 1,1

%A _Amarnath Murthy_, Nov 12 2005

%E 2 more terms from _R. J. Mathar_, Aug 31 2007

%E More terms from _Max Alekseyev_, Apr 23 2010

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | 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 April 17 22:23 EDT 2024. Contains 371767 sequences. (Running on oeis4.)