Repeated squaring computes using multiplications by reading the binary expansion of . Performing every multiplication modulo computes with the same number of modular multiplications.
Modular exponentiation evaluates a nonnegative integer power modulo . Repeated squaring according to the binary expansion of needs modular multiplications, with intermediate integers reduced modulo . This avoids constructing the potentially enormous integer . A reversible computation gives the coherent quantum modular exponentiation used in quantum order finding and discrete-logarithm Fourier sampling.
Articles by others on the same topic
Exponentiation by squaring is an efficient algorithm used to compute powers of a number, particularly useful for large exponents. This method reduces the number of multiplications needed, making it much faster than the naive approach of multiplying the base by itself repeatedly. The basic idea behind exponentiation by squaring is to take advantage of the properties of exponents.