up previous next
IsPrime --
prime integer test
|
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
the Lucas test).
/**/ IsPrime(32003);
true
/**/ IsPrime(10^100);
false
|