Modular exponentiation
Calculate a^b mod m — the remainder when a^b is divided by m. Uses fast exponentiation.
Base (a)
Exponent (b)
Mod (m)
What is modular exponentiation?
a^b mod m computes the remainder when a^b is divided by m. 2^10 mod 1000 = 1024 mod 1000 = 24.
Why is it important?
RSA cryptography computes things like 65537^d mod n with numbers hundreds of digits long. Direct computation would be impossibly large, but modular exponentiation uses repeated squaring to stay manageable.
Fast algorithm
Binary exponentiation: square-and-multiply, taking mod at each step. Computes a^b mod m in O(log b) multiplications instead of b multiplications.
Related calculators