Power Mod Calculator (Modular Exponentiation)

Your details

The number being raised to a power. Can be negative or zero.
The non-negative integer power. Large values are handled via binary exponentiation.
The divisor. Must be a positive integer (>= 1).
a^b mod n
13

The remainder when a^b is divided by n

Exponent in binary10001
Number of bits5
Normalised base (a mod n)3
Result (a^b mod n)13
a mod n3
Bit length of exponent5

3^17 mod 25 = 13

  • The remainder when 3^17 is divided by 25 is 13.
  • The binary square-and-multiply algorithm performed 4 squaring steps and at most 5 multiplications.

Next stepModular exponentiation is the core operation in RSA encryption, Diffie-Hellman key exchange, and primality tests like the Miller-Rabin test.

= Powered by OnlyCalculators