Previous Up Next

2.6.15  Test of pseudo-primality : is_pseudoprime

If is_pseudoprime(n) returns 2 (true), then n is prime.
If it returns 1, then n is pseudo-prime (most probably prime).
If it returns 0, then n is not prime.
Definition: For numbers less than 1014, pseudo-prime and prime are equivalent. But for numbers greater than 1014, a pseudo-prime is a number with a large probability of being prime (cf. Rabin’s Algorithm and Miller-Rabin’s Algorithm in the Algorithmic part (menu Help->Manuals->Programming)).
Input :

is_pseudoprime(100003)

Output :

2

Input :

is_pseudoprime(9856989898997)

Output :

2

Input :

is_pseudoprime(14)

Output :

0

Input :

is_pseudoprime(9856989898997789789)

Output :

1

Previous Up Next