up previous next
IsPrime

prime integer test

Syntax
IsPrime(N: INT): BOOL

Description
This function determines whether a positive integer is prime; if N is not positive, an error is signalled. This function may be extremely slow when N is a large prime; in practice it is usually better to call IsProbPrime.

For the curious: currently, the function first performs a probabilistic check (Miller-Rabin), if that passes, it then verifies primality (via Lucas test).

Example
/**/  IsPrime(32003);
true
/**/  IsPrime(10^100);
false

See Also