up previous next
IsProbPrime    --    checks if an integer is a probable prime


Syntax
IsProbPrime(N: INT): BOOL

Description
This function returns true if its integer argument passes a fairly stringent primality test; otherwise it returns false. There is a very small chance of the function returning true even when the argument is composite; however, if it returns false, we are certain that the argument is composite. Some people call it a "compositeness test".

This function cannot be interrupted, so be wary of inputs larger than about 2^100000 (which already takes a few minutes).

Example
/**/  IsProbPrime(2);
true

/**/  IsProbPrime(1111111111111111111);
true

/**/  [N in 1..1111 | IsProbPrime((10^N-1)/9)]; -- only five values are known
[2, 19, 23, 317, 1031]                          -- next might be 49081

See Also