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
power_mod(2, 10, 1000)In the solver,
Open in the solverpower_mod(2, 10, 1000)gives24.
Related functions
- is_prime_power
Test whether a whole number is a power of a prime.
- previous_prime
The greatest prime less than a number.
- partitions_q
How many ways a whole number is a sum of distinct positive whole numbers.
- prime_nu
How many distinct primes divide a whole number.
- partitions_p
How many ways a whole number is a sum of positive whole numbers, in any order of terms.
- prime_omega
How many primes divide a whole number, counted with multiplicity.