### 7.1.13 Testing pseudo-primality

A pseudo-prime is a number with a large probability of being prime1. 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 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

is_pseudoprime(100003)

1 |  |  |  |  |  |  |  |  |  |

is_pseudoprime(9856989898997)

2 |  |  |  |  |  |  |  |  |  |

is_pseudoprime(14)

0 |  |  |  |  |  |  |  |  |  |

is_pseudoprime(9856989898997789789)

1 |  |  |  |  |  |  |  |  |  |