nextprime
determine the next largest prime
prevprime
determine the next smallest prime
Calling Sequence
Parameters
Description
Examples
nextprime(n)
prevprime(n)
n
-
integer
The nextprime function returns the smallest prime that is larger than n. The prevprime function returns the largest prime that is less than n.
nextprime⁡1
2
nextprime⁡0
prevprime⁡2
Error, (in prevprime) there are no primes less than 2
nextprime⁡25
29
prevprime⁡3
prevprime⁡25
23
nextprime⁡31243
31247
prevprime⁡2338714
2338703
nextprime⁡26
67
See Also
isprime
ithprime
Nextpoly
Download Help Document