# previous_prime function

The greatest prime less than a number.

## How to write it

### previous_prime(n)

**n**

The number to start before. Takes a number.

## Examples

- $\displaystyle \operatorname{previous\_prime}(100) = 97$

  `previous_prime(100)`

  In the solver, `previous_prime(100)` gives `97`.

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

## Related functions

- [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.
- [prime_pi](https://hilberon.com/library/prime_pi)

  How many primes are at most a number.
- [nth_prime](https://hilberon.com/library/nth_prime)

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

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

  Test whether a whole number is a power of a prime.

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