The operation of modular exponentiation calculates the remainder when an integer b
(the base) raised to the eth power (the exponent), be, is divided by a positive integer m (the modulus). In symbols, given base b
, exponent e, and modulus m, the modular exponentiation c
is: c ≡ b^e (mod m)
.
(a + b) % m
=( a%m + b%m ) % m
(a * b) % m
=( a%m * b%m ) % m