Potência Modular a^b mod n

exponenciação rápida.
Created by
Renato Passos, Eng. de Software
Reviewed by
Renato Passos, Eng. de Software

Last updated: Apr 18, 2026

resultado
24,00

Formula

a^b mod n

About this calculator

The Modular Exponentiation calculator a^b mod n solves modular exponentiation quickly and efficiently. It computes the remainder of a raised to b divided by n using the binary exponentiation method (also known as exponentiation by squaring and multiplication). This algorithm drastically reduces the number of required operations, avoiding huge numbers and making the calculation feasible even for very large exponents.

To use it, enter the values for a (base), b (exponent), and n (modulus). The calculator processes the modular exponentiation and displays the result. For example, calculating 3^10 mod 7: the result is 4, since 3^10 = 59049 and 59049 mod 7 = 4. This tool is useful in areas such as RSA cryptography, number theory, and computing, where modular operations with large exponents are common.

Be careful: ensure n is positive (modulus). Negative exponents are not directly supported; in that case, you would need to compute the modular inverse. Also, if n is very large, the result may take time, but the algorithm is optimized for exponents up to thousands of bits. For small values, the calculation is instantaneous.

Frequently asked questions

What is modular exponentiation?

It is the calculation of the remainder when a^b is divided by n, denoted as a^b mod n. It is useful in cryptography and number theory.

How does fast exponentiation work?

The algorithm uses the binary representation of the exponent to reduce the number of multiplications, performing squaring and multiplication step by step.

Can I use negative exponents?

Not directly. Negative exponents require computing the modular inverse, which is not implemented in this calculator.

What is the size limit for numbers?

There is no practical limit for base and exponent, but very large numbers may slow down the calculation. The modulus must be a positive integer.

Is the result always less than n?

Yes, by definition, the remainder of division by n is between 0 and n-1.

Other Sequencias e Numeros calculators