Compute aⁿ mod m using modular exponentiation. See the result, step-by-step binary exponentiation, repeated squaring table, and binary decomposition of the exponent.
Computing large powers modulo a number is fundamental in number theory, cryptography, and competitive programming. Directly calculating aⁿ and then taking the remainder is impractical for large exponents because the intermediate value can be astronomically large. Modular exponentiation solves this efficiently by applying the modulus at every multiplication step, keeping numbers small throughout. The standard algorithm — variously called binary exponentiation, exponentiation by squaring, or the square-and-multiply method — decomposes the exponent n into its binary representation and processes each bit in turn. This Power Modulo Calculator lets you enter any base a, exponent n, and modulus m, then instantly displays the result along with a full breakdown of the binary exponentiation process. A step-by-step table shows the repeated-squaring values and which bits trigger a multiplication into the accumulator. A binary decomposition visual highlights each bit of the exponent. Eight presets cover classic examples including small demonstrations and realistic cryptographic-scale scenarios. Whether you are studying for a number theory exam, implementing RSA, or debugging a competitive-programming solution, this tool gives you transparent, verifiable results.
Power Modulo Calculator — aⁿ mod m helps you solve power modulo calculator — aⁿ mod m problems quickly while keeping each step transparent. Instead of redoing long algebra by hand, you can enter Base (a), Exponent (n), Modulus (m) once and immediately inspect Result, Exponent in Binary, Number of Bits to validate your work.
This is useful for homework checks, classroom examples, and practical what-if analysis. You keep the conceptual understanding while reducing arithmetic mistakes in multi-step calculations.
aⁿ mod m via binary exponentiation: write n in binary as bₖbₖ₋₁…b₁b₀. Start with result = 1 and base = a mod m. For each bit from LSB to MSB: if bᵢ = 1 then result = result · base mod m; then base = base² mod m.
Result: Result shown by the calculator
Using the preset "2¹⁰ mod 1000", the calculator evaluates the power modulo calculator — aⁿ mod m setup, applies the selected algebra rules, and reports Result with supporting checks so you can verify each transformation.
This calculator takes Base (a), Exponent (n), Modulus (m) and applies the relevant power modulo calculator — aⁿ mod m relationships from your chosen method. It returns both final and intermediate values so you can audit the process instead of treating it as a black box.
Start with the primary output, then use Result, Exponent in Binary, Number of Bits, Multiplications to confirm signs, magnitude, and internal consistency. If anything looks off, change one input and compare the updated outputs to isolate the issue quickly.
A strong workflow is manual solve first, calculator verify second. Repeating that loop improves speed and accuracy because you learn to spot common setup errors before they cost points on multi-step algebra problems.
Modular exponentiation computes aⁿ mod m efficiently without calculating the full value of aⁿ, by taking the modulus at each step. Use this as a practical reminder before finalizing the result.
For large n, aⁿ can have millions of digits — far too large to store or compute. Modular exponentiation keeps every intermediate product below m².
Binary exponentiation decomposes n into its binary bits and uses the identity a²ᵏ = (aᵏ)². This reduces n multiplications to about log₂(n).
Yes. "Square-and-multiply", "binary exponentiation", and "exponentiation by squaring" all refer to the same O(log n) algorithm.
RSA encryption and decryption both rely on modular exponentiation with very large numbers (typically 2048+ bits). The security depends on the difficulty of factoring m.
By convention a⁰ = 1 for any a, so a⁰ mod m = 1 mod m. The calculator handles this case directly.