Search the documentation

Type to search. Use ↑ and ↓ to move, Enter to open.

Modular exponentiation

Computes a^b mod m with O(log b) multiplications by repeated squaring.

2
projects
2
run in the browser
Defining formula
a2k=(ak)2,a2k+1=a (ak)2a^{2k} = \bigl(a^{k}\bigr)^{2}, \qquad a^{2k+1} = a\,\bigl(a^{k}\bigr)^{2}

Square and multiply: a^e mod n takes about log₂ e steps.

On this page

Projects that use it

Neighbourhood in the knowledge graph

Modular exponentiationNumber theory and algebraModular arithmeticNumber Theory ExplorerCryptography in CEuclidean algorithmPrime sievesPrimality testingEuler's totient functionArithmetic functionsLinear recurrencesCryptography Performance AnalysisSorting Algorithms VisualizationBlock ciphersFinite fieldsCryptographic hash functionsMessage authentication codesRSAArbitrary-precision arithmeticSolvatore
ProjectsConceptsDomainsShow in graph →