Next Prime

Author

Eric W. Weisstein
December 31, 2003

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/NextPrime.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/NextPrime.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Initialization

<<NumberTheory`NumberTheoryFunctions`

Sequence

NextPrime/@Range[20]

Formula

NP[n_]:=Prime[1+PrimePi[n]]

Subtract@@@Table[{NP[n],NextPrime[n]},{n,10}]

Smallest n-Digit Primes

NextPrime[10^#]&/@Range[0,20]

(NextPrime[10^#]-10^#)&/@Range[0,20]

<<Utilities`Plot`

IntegerListPlot[(NextPrime[10^#]-10^#)&/@Range[0,100],
AxesLabel->TraditionalForm/@{n,NP[10^n]-10^n}]