Regev’s factoring algorithm
See how several modular directions and classical lattice processing can reduce the size of a factoring circuit per run.
- Trace a small modular relation into a lattice constraint.
- Separate per-run circuit cost from repetition and classical work.
- Distinguish the original heuristic from subsequent rigorous variants.
Before you begin: Shor’s algorithm, modular arithmetic, Fourier sampling and an introduction to lattices.
From a period to a lattice of relations
Section titled “From a period to a lattice of relations”Shor’s factoring method finds repetition in modular powers. Regev’s approach uses several small bases simultaneously and looks for a multidimensional collection of relations. A lattice is an orderly set of integer combinations of basis vectors. Here its points describe exponent choices that make a modular product equal one.
The worked relation below uses ordinary multiplication and greatest common divisors. The full proof requires advanced number theory.
Let be an odd composite integer, after straightforward cases such as prime powers have been handled classically. Choose small integers coprime to , and set . Consider
Negative exponents mean modular inverses, which exist because the chosen bases are coprime to . The relation lattice is
For a relation , define . Since the are squares, . If is a nontrivial square root of one, the classical calculation gives a nontrivial factor.
Checkpoint. Does every relation guarantee a factor? No. A relation producing or is unhelpful for this step. The post-processing must obtain a useful relation.
Worked example: a complete small relation
Section titled “Worked example: a complete small relation”Use , and . Both are coprime to 15, and
The vector is a relation because . Since , its corresponding square root is
Check . Then
This relation was chosen by inspection. The quantum and lattice algorithms obtain suitable information for large, unknown instances.
In this toy example, , and 4 has order two. Therefore consists of integer points with even. One basis is . The relation lattice can be drawn as a checkerboard subset of the integer grid.
What the quantum circuit samples
Section titled “What the quantum circuit samples”The algorithm prepares a smoothly weighted superposition over exponent vectors, coherently computes into a value register, then Fourier transforms the exponent registers and measures them. Ignoring or measuring the value register groups exponents with the same modular product. Differences between such exponents lie in .
Fourier sampling gives approximate information about the dual lattice,
Several independent runs provide samples for classical lattice processing. The processing reconstructs enough relation information to attempt the square-root and gcd step. The measurement output is therefore an input to a classical algorithm, rather than a list of factors by itself.
The toy circuit’s operations prepare smoothly weighted exponent registers. Here each modular multiplier is controlled by the least significant exponent bit: higher bits contribute identity because . The four-qubit multiplier fixes the unused basis state 15, completing a reversible permutation. The grid marks the relation lattice in blue and the useful vector in teal.
Interpret the improvement precisely
Section titled “Interpret the improvement precisely”Regev’s original 2023 result uses gates per quantum run for an -bit input, with independent runs and polynomial classical processing. The tilde suppresses logarithmic factors. Multiplying the per-run cost by the number of runs gives a different total-work quantity. Reducing the size or depth of an individual coherent circuit can still be valuable when hardware reliability constrains each run.
The original analysis used a number-theoretic heuristic. Subsequent space-efficient work reduces the required qubit count, and Pilatte establishes unconditional correctness for slightly modified variants, preserving the improvement up to logarithmic factors. These are mathematical algorithm results. A practical RSA resource comparison additionally needs concrete arithmetic, error correction, connectivity, runtime and success targets.
Exercises
Section titled “Exercises”Draw the toy lattice and test its basis vectors freely. For , compute : this relation is unhelpful. For , recover the useful value 11. The contrast shows why finding a relation and finding a factor are separate tasks.
-
Is a relation, and is it useful?
-
What should a resource table separate?
Worked answers
-
yes: . It gives , so .
-
qubits, gates/depth per run, run count, classical work and physical implementation assumptions.
Check your understanding
Section titled “Check your understanding”What does the headline gate improvement describe?
Answer: The size of a quantum circuit used in each run. Repetition and classical processing remain part of the full algorithm.
Regev’s approach replaces one-dimensional period finding with multidimensional relation finding. The useful output emerges from quantum samples, classical geometry and modular arithmetic working together.
Sources
Section titled “Sources”Regev, original algorithm; Ragavan and Vaikuntanathan, space-efficient variant; Pilatte, unconditional variants, revised August 2026. The relation, grid and circuit figure above are original instructional calculations.
Ready for the next step?
Your progress stays in this browser.