# Test of pseudo-primality: is_pseudoprime

### 5.5.13 Test of pseudo-primality: is_pseudoprime

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)). For numbers less than 1014, pseudo-prime and prime are equivalent.

The is_pseudoprime command is a test for a pseudo-prime.

- is_pseudoprime takes one argument:
  n, an integer.
- is_pseudoprime(n) returns 0, 1 or 2.
  - If it returns 0, then n is not prime.
  - If it returns 1, then n is a prime.
  - If it returns 2, then n is pseudo-prime (most probably prime).

#### Examples.

- Input:
  is_pseudoprime(100003)
  Output:

  1

- Input:
  is_pseudoprime(9856989898997)
  Output:

  2

- Input:
  is_pseudoprime(14)
  Output:

  0

- Input:
  is_pseudoprime(9856989898997789789)
  Output:

  1