Method Gmp.mpz()->probably_prime_p()


Method probably_prime_p

int(0..2) probably_prime_p(void|int count)

Description

Return 2 if this mpz object is a prime, 1 if it probably is a prime, and 0 if it definitely is not a prime. Testing values below 1000000 will only return 2 or 0.

Parameter count

The prime number testing is using Donald Knuth's probabilistic primality test. The chance for a false positive is pow(0.25,count). Default value is 25 and resonable values are between 15 and 50.