Skip to content
NOUMENResearch
Network
Engineering
, home page

White light split by a prism. The Fourier transform in this experiment separates frequencies the way a prism separates colours. Generated image. Shows no real place.

Experiment 1

Factor a number the way a quantum computer would.

Run Shor's algorithm on 15 or 21, one step at a time, on a simulator of twelve to fourteen qubits.

Experiment 1Shor's algorithmSimulation in your browser. Not a quantum computer.

Instrument

Number to factor
Base a (shares no factor with 15)
  1. 1. Start
  2. 2. Superposition
  3. 3. Modular exponentiation
  4. 4. Inverse Fourier transform
  5. 5. Measurement
  6. 6. Classical part
c0c1c2c3c4c5c6c7work4HHHHHHHH×7×4×1×1×1×1×1×1QFT†

Counting register: probability of each value 0 to 255

100%064128192255
Shor's algorithm on 12 simulated qubits: the circuit, then the probability of each value of the counting register, computed from the amplitudes.

Reading

Ready. The counting register (8 qubits) holds 0 and the work register (4 qubits) holds 1.

Number
15
Base
7
Qubits
8 counting + 4 work = 12
Step
1 of 6, Start
Measured
not yet
Chance a run gives factors
50.0 percent, from the amplitudes

Your browser is not running script, so this is a finished run of the experiment.

Instrument

Number to factor
Base a (shares no factor with 15)
  1. 1. Start
  2. 2. Superposition
  3. 3. Modular exponentiation
  4. 4. Inverse Fourier transform
  5. 5. Measurement
  6. 6. Classical part
c0c1c2c3c4c5c6c7work4HHHHHHHH×7×4×1×1×1×1×1×1QFT†

Counting register: probability of each value 0 to 255

100%064128192255

Work register: probability of each value 0 to 15

14713
Shor's algorithm on 12 simulated qubits: the circuit, then the probability of each value of the counting register, computed from the amplitudes.

Reading

192/256 is close to a fraction with denominator 4, and 7^4 mod 15 is 1, so the period is 4. Then 7^2 mod 15 is 4, and the greatest common divisors of 3 and 5 with 15 are 3 and 5. 15 = 3 × 5.

Number
15
Base
7
Qubits
8 counting + 4 work = 12
Step
6 of 6, Classical part
Measured
192 of 256
Fraction
192/256, continued fraction [0, 1, 3]
Period
4
Factors
3 × 5
Chance a run gives factors
50.0 percent, from the amplitudes

Method

To factor a number N, pick a base a that shares no factor with N. The powers of a, taken mod N, repeat with some period r. If r is even and a to the power r/2 is not minus 1 mod N, then the greatest common divisors of ar/2 minus 1 and ar/2 plus 1 with N are factors of N. Finding r is the hard part, and it is the only part a quantum computer does.

The quantum part

  1. Hadamard gates put the counting register into an equal mix of every value x from 0 to Q minus 1.
  2. Controlled multiplications put ax mod N into the work register, for every x at once. The values repeat every r steps.
  3. The inverse quantum Fourier transform turns that repetition into peaks near multiples of Q/r.
  4. Measuring the counting register gives one value y, at random, with the probabilities shown.

The classical part

The fraction y/Q is close to some fraction j/r. Continued fractions find it: the page keeps the last approximation whose denominator is below N and checks that a to that power is 1 mod N. Then two greatest common divisors give the factors. Some runs fail: a measurement of 0, a value that gives a divisor of r instead of r, or a base whose period is odd or whose half power is minus 1. That is the algorithm, not a fault of the page: the fix is to run it again or pick another base.

What is simulated

The page keeps every amplitude of the state in memory: 4,096 complex numbers for 15 (8 counting qubits, so that 28 is at least 15 squared, and 4 work qubits) and 16,384 for 21 (9 and 5). Every bar is computed from those amplitudes, and the measurement is drawn with them. The modular multiplications are applied directly as reversible operations on the work register; a real machine would build them from many elementary gates and extra qubits. Each extra qubit doubles the memory a simulation needs, which is why classical simulation cannot factor real keys either.

Why it matters for RSA and elliptic curves

RSA rests on factoring being hard, and elliptic curve cryptography on discrete logarithms being hard. Shor's paper gives polynomial-time quantum algorithms for both problems. NIST's ML-KEM standard (FIPS 203) says that if large-scale quantum computers are realized, schemes based on integer factorization and discrete logarithms, over finite fields and elliptic curves, will be at risk.

Why no one factors real keys this way

Factoring a real RSA modulus needs a machine far beyond this one. The most recent published estimate we read (Gidney, May 2025) is that a 2048 bit RSA number could be factored in less than a week by a quantum computer with less than a million noisy qubits. This page makes no prediction of when such a machine might exist.

Try it on your codeThe scanner lists the cryptography a project depends on.