# Modular exponentiation (power_mod)

A power modulo a number: base^exponent mod modulus.

## How to write it

### power_mod(base, exponent, m)

**base**

The base. Takes a whole number.

**exponent**

The exponent. Takes a whole number.

**m**

The modulus. Takes a whole number.

## Examples

- $\displaystyle \operatorname{power\_mod}(2, 10, 1000) = 24$

  `power_mod(2, 10, 1000)`

  In the solver, `power_mod(2, 10, 1000)` gives `24`.

  [Open in the solver](https://hilberon.com/?q=power_mod%282%2C%2010%2C%201000%29)

## Related functions

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

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

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

  How many ways a whole number is a sum of distinct positive whole numbers.
- [prime_nu](https://hilberon.com/library/prime_nu)

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

  How many ways a whole number is a sum of positive whole numbers, in any order of terms.
- [prime_omega](https://hilberon.com/library/prime_omega)

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

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