Exact quantum factoring over a fixed finite gate set

Proves polynomial-size quantum circuits over a fixed gate set factor every integer with probability exactly one.

1 paper September 25, 2026 Explained by AI

Shor's 1994 quantum algorithm factors whole numbers quickly, but it can fail and must sometimes be rerun. This paper builds quantum circuits that output the full prime factorization of every number with probability exactly one. They use one fixed, small set of gates and stay polynomial in size. Lean checks the main theorem; the circuits are far too large to be practical.

First step
1994
Shor, polynomial-time quantum factoring with bounded error
Significance
Solid
It removes the failure probability from quantum factoring while keeping one fixed finite gate set and polynomial worst-case size.
Trust
Formal proof listed
Field
Mathematical physics
1 paper

The explanation

Factor N = 15 the quantum way. Pick a = 7 and look at its powers modulo 15. They run 7, 4, 13, 1, so the order of 7 is r = 4. The order is the least power that gives 1. Half the order gives 7² ≡ 4, a square root of 1 that is not ±1. Then gcd(4 − 1, 15) = 3 and gcd(4 + 1, 15) = 5. So 15 = 3 × 5.

Shor's algorithm finds orders quickly with a quantum computer. It factors in polynomial time with bounded error. Bounded error means each run can fail with some small chance. Checking a proposed answer makes reruns reliable. But a procedure that retries until success need not have a polynomial worst-case running time. Exact versions existed only in stronger models. Mosca's exact algorithm allowed gate settings computed during the run. The obstacle with a fixed gate set is that rotations by arbitrary angles cannot be built exactly. Approximating them ever more finely does not give probability-one answers.

The paper proves a uniform family of polynomial-size quantum circuits. Uniform means an ordinary computer can write out each circuit in polynomial time. The circuits output the complete prime factorization of every N ≥ 2 with probability one. One fixed finite gate set suffices: NOT, CNOT, Toffoli, Hadamard, diag(1, i), their inverses and singly controlled versions. The gate and qubit counts are bounded by a fixed polynomial in the bit length of N.

The key trick ends with amplitude amplification, a step that boosts the chance of a good outcome. Suppose a good outcome has probability exactly 1/4. Write this as sin²θ = 1/4, so θ = 30°. One amplification step turns the probability into sin²(3θ) = sin²(90°) = 1. So the whole difficulty is making the success probability exactly 1/4. The paper does this with dyadic numbers, fractions whose denominators are powers of two. Its order trial hits the true order with an exact dyadic probability. Along the way, each run also factors p − 1 for its primes p, recursively. A deterministic primality test, adapted from Agrawal, Kayal and Saxena, checks the prime labels.

The constructions are not meant to save resources. Their large polynomial sizes are not offered as practical improvements. The paper makes no claim of a classical polynomial-time factoring algorithm.

How sure is this? Lean, a computer proof checker, has a formal proof of the main theorem. It covers the uniform polynomial-size circuit family, the fixed gate set and the exact probability one. No specialist review of the paper has been published.

What it doesn't show. This does not give a practical speed-up, a classical factoring method, or circuits small enough for any foreseeable quantum computer.

Where it came from

This result comes from an unreleased OpenAI model, published in the openai/math release on 6 October 2026.

Hype check

Solid. Lean covers the main theorem; the circuits are polynomial but very large and are not a practical improvement. No specialist review is published.

Words used

Order
For a modulo m, the least positive r with a^r ≡ 1 (mod m).
Bounded error
Each run is right with probability at least some fixed amount, such as 2/3, but may fail.
Gate set
The fixed list of basic operations a quantum circuit is allowed to use.
Uniform circuit family
One circuit for each input length, all written out by a single efficient ordinary program.
Amplitude amplification
A quantum step that raises the probability of a marked outcome, generalizing Grover's search.
Dyadic rational
A fraction whose denominator is a power of two, such as 3/8.
Polynomial size
The number of gates and qubits grows at most like a fixed power of the number of input digits.

The original paper

All quoted lines (12)

  1. Shor's quantum algorithms established polynomial-time factorization and discrete logarithms with bounded error.
    Exact quantum factoring over a fixed finite gate set Back to text
  2. Verifying a proposed factorization makes repetition reliable, but a procedure that retries until success need not have a polynomial worst-case running time.
    Exact quantum factoring over a fixed finite gate set Back to text
  3. Their discussion also reports Mosca's exact factoring algorithm in a generalized model permitting gate parameters obtained during the computation; see also.
    Exact quantum factoring over a fixed finite gate set Back to text
  4. Approximating an arbitrary-angle rotation to increasingly high precision likewise does not by itself yield probability-one correctness over a fixed finite gate set.
    Exact quantum factoring over a fixed finite gate set Back to text
  5. There is a polynomial-time uniform family of polynomial-size quantum circuits that outputs the complete prime factorization of every input integer N≥2N\ge2 with probability one.
    Exact quantum factoring over a fixed finite gate set Back to text
  6. One fixed finite gate set suffices: NOT, CNOT, Toffoli, Hadamard, diag⁡(1,i)\operatorname{diag}(1,i), their inverses, and their singly controlled versions.
    Exact quantum factoring over a fixed finite gate set Back to text
  7. The number of gates and qubits is bounded by a fixed polynomial in the bit length of NN.
    Exact quantum factoring over a fixed finite gate set Back to text
  8. Here the preceding construction makes that probability exactly 1/41/4 using dyadic arithmetic and the fixed gates, so the established pair of sign reflections suffices.
    Exact quantum factoring over a fixed finite gate set Back to text
  9. First, it constructs an order trial whose mass on the true order is a prescribed dyadic rational, meaning a rational with a power-of-two denominator.
    Exact quantum factoring over a fixed finite gate set Back to text
  10. The appendix adapts the polynomial-congruence method of Agrawal, Kayal, and Saxena, with its constants and auxiliary-prime choice established directly.
    Exact quantum factoring over a fixed finite gate set Back to text
  11. Its large polynomial parameters are not intended as practical resource improvements.
    Exact quantum factoring over a fixed finite gate set Back to text
  12. It makes no claim of a classical deterministic or randomized polynomial-time factoring algorithm.
    Exact quantum factoring over a fixed finite gate set Back to text

Other sources

  1. openai/math, Lean scope note for family 279 The probability-one conclusion is exact, rather than an asymptotic or bounded-error guarantee.
  2. openai/math release notes (2026): model provenance and review status manuscripts and supporting proof artifacts produced by an internal OpenAI model

Browse Mathematical physics Quantum theoryOpen since the 1990sLean-checked resultsSolid results