# Primality test (is_prime)

Test whether a whole number is prime.

## How to write it

### is_prime(n)

**n**

The number to test. Takes a whole number.

## Examples

- $\displaystyle 97 \text{ prime?} = \operatorname{true}$

  `is_prime(97)`

  In the solver, `is_prime(97)` gives `true`.

  [Open in the solver](https://hilberon.com/?q=is_prime%2897%29)

## Related functions

- [is_prime_power](https://hilberon.com/library/is_prime_power)

  Test whether a whole number is a power of a prime.
- [next_prime](https://hilberon.com/library/next_prime)

  The least prime greater than a number.
- [nth_prime](https://hilberon.com/library/nth_prime)

  The n-th prime, counting 2 as the first.
- [previous_prime](https://hilberon.com/library/previous_prime)

  The greatest prime less than a number.
- [prime_nu](https://hilberon.com/library/prime_nu)

  How many distinct primes divide a whole number.
- [prime_omega](https://hilberon.com/library/prime_omega)

  How many primes divide a whole number, counted with multiplicity.

---
Source: https://hilberon.com/library/is_prime
