NextPrime

WMA link


NextPrime[n]

gives the next prime after n.

NextPrime[n,k]

gives the kth prime after n.

The the first number does not have to be an integer:

However, when the second value, the step value is not an integer is given, we do nothing:

With a negative number, we find a prime number before the given number:

And with negative counts, it is possible to get negative prime numbers:

MoebiusMu
PartitionsP