prev_prime SciMax Toolbox primep_number_of_tests

SciMax Toolbox >> primep

primep

Maxima Function

Calling Sequence

primep (n)

Description

Primality test. If primep (n) returns false, n is a composite number and if it returns true, n is a prime number with very high probability.

For n less than 341550071728321 a deterministic version of Miller-Rabin's test is used. If primep (n) returns true, then n is a prime number.

For n bigger than 34155071728321 primep uses primep_number_of_tests Miller-Rabin's pseudo-primality tests and one Lucas pseudo-primality test. The probability that n will pass one Miller-Rabin test is less than 1/4. Using the default value 25 for primep_number_of_tests, the probability of n beeing composite is much smaller that 10^-15.

prev_prime SciMax Toolbox primep_number_of_tests