A088104 Smallest n-digit prime beginning with prime(n), or 0 if no such prime exists.
2, 31, 503, 7001, 11003, 130003, 1700021, 19000013, 230000003, 2900000017, 31000000027, 370000000003, 4100000000003, 43000000000063, 470000000000023, 5300000000000129, 59000000000000011, 610000000000000031, 6700000000000000021, 71000000000000000047, 730000000000000000001
Offset: 1
Examples
a(6) = 130003 begins with prime(6) = 13 and has 6 digits.
Links
- David A. Corneth, Table of n, a(n) for n = 1..723
Programs
-
Mathematica
Prepend[NextPrime[FromDigits[PadRight[IntegerDigits[#],PrimePi[#]]]]&/@Prime[Range[2,25]],2] (* Harvey P. Dale, Jan 09 2011 *)
-
PARI
a(n) = my(p=prime(n), d=digits(p)); c=nextprime(p*10^(n-#d)); cd=digits(c); if(vector(#d, i, cd[i]) == d, return(c), return(0)) \\ David A. Corneth, Apr 13 2019
-
Python
from sympy import prime, nextprime def A088104(n): p = prime(n) return nextprime(p*10**(n-len(str(p)))-1) # Chai Wah Wu, Jun 18 2019
Extensions
More terms from Ray Chandler, Oct 15 2003
More terms from David A. Corneth, Apr 13 2019
Comments