login
Smallest prime with prime(n) decimal digits.
4

%I #35 Apr 14 2024 02:54:39

%S 11,101,10007,1000003,10000000019,1000000000039,10000000000000061,

%T 1000000000000000003,10000000000000000000009,

%U 10000000000000000000000000331,1000000000000000000000000000057,1000000000000000000000000000000000067,10000000000000000000000000000000000000121

%N Smallest prime with prime(n) decimal digits.

%H Alois P. Heinz, <a href="/A064490/b064490.txt">Table of n, a(n) for n = 1..168</a> (first 75 terms from Harry J. Smith)

%F a(n) = A003617(A000040(n)).

%F a(n) = A000040(A064489(n)).

%e 11 is the first prime with 2 decimal digits.

%e 101 is the first prime with 3 decimal digits.

%p for n from 1 to 20 do p := ithprime(n): for i from 10^(p-1) to 10^p do if isprime(i) then printf(`%d,`,i); break; fi: od: od:

%p # second Maple program:

%p a:= n-> nextprime(10^(ithprime(n)-1)):

%p seq(a(n), n=1..15); # _Alois P. Heinz_, Jun 24 2018

%t Table[NextPrime[10^(n-1)],{n,Prime[Range[15]]}] (* _Harvey P. Dale_, Feb 06 2020 *)

%o (PARI) l(n)=ln=0; while(n,n=floor(n/10); ln++); return(ln);

%o a=0; for(n=1,10^6,x=l(prime(n)); if(isprime(x),b=x; if(b>a,a=b; print(prime(n)))))

%o (PARI) { for (n=1, 75, p=prime(n); a=nextprime(10^(p - 1)); write("b064490.txt", n, " ", a) ) } \\ _Harry J. Smith_, Sep 16 2009

%o (Python)

%o from sympy import prime, nextprime, primepi

%o def a(n): return nextprime(10**(prime(n)-1))

%o print([a(n) for n in range(1, 14)]) # _Michael S. Branicky_, May 26 2021

%Y Cf. A000040, A003617, A064489.

%K base,nonn

%O 1,1

%A _Jason Earls_, Oct 04 2001

%E More terms from _James A. Sellers_, Oct 08 2001

%E Offset changed from 0 to 1 by _Harry J. Smith_, Sep 16 2009