up previous next
NextPrime, PrevPrime

find the next largest prime number

Syntax
NextPrime(N: INT): INT
PrevPrime(N: INT): INT

Description
The first function computes the smallest prime number greater than N . If N is negative or too large then an error is signalled. The upper limit depends on the computer you are using; it is probably 2^31 or 2^63.

The second function computes the greatest prime number smaller than N . If N is less than 3 or too large then an error is signalled.

Example
/**/  NextPrime(1000);
1009
/**/ PrevPrime(1000);
997

See Also