Skip to content
Current section
The Quantum Computing Enthusiast’s Hub
Saved
All sections

All sections

Saved
Skip Learn navigation
Encyclopedia
Glossary

Modular arithmetic

Arithmetic in which values that differ by a multiple of a fixed positive modulus are equivalent. Each class can be represented by its remainder, as with hours on a clock.

Also called arithmetic modulo N, Modular number arithmetic

Edition released Entry updated Coverage: Overview
On this page

Plain-language explanation

Numbers differing by a multiple of N are treated as equivalent modulo N. Addition and multiplication wrap around this set of remainders. Powers can therefore repeat, creating useful periodic structure. In a quantum algorithm, modular arithmetic must be implemented coherently and reversibly on encoded values, rather than performed as an ordinary irreversible lookup.

This is enough number theory for a beginner to understand the central idea of Shor's algorithm. A small worked sequence is often more useful than a long historical explanation.

Example

Modulo 7, the value 10 is equivalent to 3 because dividing 10 by 7 leaves remainder 3. Powers of 2 give remainders 2, 4, 1 and then repeat. The wraparound is what creates the order-three pattern.

Scope and limits

Modular arithmetic is not uniquely quantum. Classical computers perform it efficiently for many tasks; quantum algorithms use it within a larger coherent procedure.

Order finding is a related idea. Modular arithmetic supplies the operations. Order finding asks for the repeat length of a particular modular-power sequence.

Sources

  • Peter W. Shor · Reference · arXiv
    Verification scope

    Recorded source check ·

    Theoretical factoring and discrete-logarithm algorithms and their scaling

    Expanded preprint of the 1994 result; no claim about contemporary cryptographic-scale execution.

  • John Preskill, Caltech · Reference · preskill.caltech.edu
    Verification scope

    Recorded source check ·

    Quantum query methods, Fourier methods, phase estimation and algorithms

    Algorithm guarantees depend on access and resource models.