pow_mod

Function pow_mod 

Source
pub fn pow_mod(x: i64, n: i64, m: u32) -> u32
Expand description

Returns $x^n \bmod m$.

§Constraints

  • $0 \leq n$
  • $1 \leq m$

§Panics

Panics if the above constraints are not satisfied.

§Complexity

  • $O(\log n)$

§Example

use ac_library::math;

assert_eq!(math::pow_mod(2, 10000, 7), 2);