login
Smallest n-digit prime.
(Formerly M2008)
55

%I M2008 #41 Jan 21 2022 03:58:49

%S 2,11,101,1009,10007,100003,1000003,10000019,100000007,1000000007,

%T 10000000019,100000000003,1000000000039,10000000000037,

%U 100000000000031,1000000000000037,10000000000000061,100000000000000003,1000000000000000003,10000000000000000051

%N Smallest n-digit prime.

%D O'Hara, J. Rec. Math., 22 (1990), Table on page 278.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H Giovanni Resta, <a href="/A003617/b003617.txt">Table of n, a(n) for n = 1..1000</a> (terms 1..200 from T. D. Noe. _Jon E. Schoenfield_ used Magma to verify that terms 1..200 are primes, Jan 31 2009)

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/NextPrime.html">Next Prime</a>

%H R. G. Wilson, v., <a href="/A003617/a003617.pdf">Extract from letter to N. J. A. Sloane, May 20 1994</a>, with annotated scanned copy of page 278 of O'Hara article.

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

%p seq(a(n), n=1..20); # _Alois P. Heinz_, Feb 11 2021

%t Table[a := 10^n + 1; While[ ! PrimeQ[a], a++ ]; a, {n, 0, 30}] (* _Stefan Steinerberger_, Apr 08 2006 *)

%t NextPrime/@(10^Range[0,20]) (* _Harvey P. Dale_, May 01 2011 *)

%o (PARI) a(n)=nextprime(10^(n-1)) \\ _Charles R Greathouse IV_, Jul 15 2011

%o (Python)

%o from sympy import nextprime

%o print([nextprime(10**(n-1)) for n in range(1, 21)]) # _Michael S. Branicky_, Feb 11 2021

%Y Cf. A003618, A033873.

%K nonn,nice,base

%O 1,1

%A _N. J. A. Sloane_, _Mira Bernstein_

%E More terms from _Stefan Steinerberger_, Apr 08 2006