Function utils::number::mod_pow

source ·
pub fn mod_pow<T: UnsignedInteger>(base: T, exponent: T, modulus: T) -> T
Expand description

Calculates base.pow(exponent) % modulus.

§Examples

assert_eq!(mod_pow::<u64>(2, 10, 1000), 24);
assert_eq!(mod_pow::<u64>(65, 100000, 2147483647), 1085966926);