TOPICS
Search

Next Prime


The next prime function NP(n) gives the smallest prime larger than n. The function can be given explicitly as

 NP(n)=p_(1+pi(n)),

where p_i is the ith prime and pi(n) is the prime counting function. For n=1, 2, ... the values are 2, 3, 5, 5, 7, 7, 11, 11, 11, 11, 13, 13, 17, 17, 17, 17, 19, ... (OEIS A007918).

The next prime function is implemented in the Wolfram Language as NextPrime[n].

NextPrime

Finding the next prime after 10^(n-1) gives the smallest n-digit prime. For n=1, 2, ..., the first few of these are 2, 11, 101, 1009, 10007, 100003, 1000003, ... (OEIS A003617). The amounts by which these exceed 10^n are 1, 1, 1, 9, 7, 3, 3, 19, 7, 7, ... (OEIS A033873).


See also

Fortunate Prime, Previous Prime, Prime Counting Function, Prime Number

Explore with Wolfram|Alpha

References

O'Hara, F. "The Smallest and Largest N-Digit Primes for N=1(1)150." J. Recr. Math. 22, No. 4, 277-279, 1990.Sloane, N. J. A. Sequences A003617/M2008, A007918, and A033873 in "The On-Line Encyclopedia of Integer Sequences."

Referenced on Wolfram|Alpha

Next Prime

Cite this as:

Weisstein, Eric W. "Next Prime." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/NextPrime.html

Subject classifications