- NextPrime is also known as previous prime.
- Mathematical function, suitable for both symbolic and numerical manipulation.
- For positive x, NextPrime[x] is the (m+1) prime number where m is the number of primes less than or equal to x.
- NextPrime[x, k] is the (m+k) prime number where m is the number of primes less than or equal to x.
Examplesopen allclose all
Numerical Manipulation (7)
Symbolic Manipulation (2)
Find a solution instance of equalities with NextPrime:
Basic Applications (6)
Highlight the sequence of primes using NextPrime:
Visualize the primes with a parabolic sieve:
Visualize the sieve of Eratosthenes for the first 5 primes:
Spiral of a NextPrime sequence:
Hexagonal prime spiral using NextPrime:
Find the lowest-divisor pair for an integer :
Find the prime factorization for an integer :
Number Theory (5)
NextPrime numbers modulo 10:
NextPrime numbers modulo :
Plot prime gaps around powers of 10:
Visualize the gaps between primes below 104:
Plot a histogram of the closest distances to a prime for a range of integers:
Compare the NextPrime sequence to PrimePi:
It is conjectured that for any integer , there is a prime with :
Properties & Relations (4)
Wolfram Research (2007), NextPrime, Wolfram Language function, https://reference.wolfram.com/language/ref/NextPrime.html (updated 2020).
Wolfram Language. 2007. "NextPrime." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/NextPrime.html.
Wolfram Language. (2007). NextPrime. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NextPrime.html