Test of primality : is_prime isprime isPrime

### 4.6.16 Test of primality : is_prime isprime isPrime

is_prime(n) returns 1 (true) if n is prime and 0 (false) if n is not prime.
isprime returns true or false.
Use the command pari("isprime",n,1) to have a primality certificate (see the documentation PARI/GP with the menu Help->Manuals->PARI-GP) and pari("isprime",n,2) to use the APRCL test.

Input :

is_prime(100003)

Output :

1

Input :

isprime(100003)

Output :

true

Input :

is_prime(98569898989987)

Output :

1

Input :

is_prime(14)

Output :

0

Input :

isprime(14)

Output :

false

Input :

pari("isprime",9856989898997789789,1)

This returns the coefficients giving the proof of primality by the p−1 Selfridge-Pocklington-Lehmer test :

[[2,2,1],[19,2,1],[941,2,1],[1873,2,1],[94907,2,1]]

Input :

isprime(9856989898997789789)

Output :

true