Skip to content

Files

Latest commit

 

History

History
 
 

fast-exponentiation

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Fast Exponentiation Algorithm

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).

Modular Arithmetic

  • (a + b) % m = ( a%m + b%m ) % m
  • (a * b) % m = ( a%m * b%m ) % m

References