Shor's Algorithm: How Quantum Computers Factor Numbers
Shor's algorithm is a quantum algorithm for finding the prime factors of a whole number. On an ordinary computer, factoring a large number built from two large primes is punishingly slow, and much of modern digital security quietly depends on that slowness. Shor's algorithm shows that a sufficiently capable quantum computer could do the same job in a fundamentally different amount of time, which is why it sits at the centre of so many conversations about the future of cryptography.
It was introduced in the 1990s, in the first wave of results showing that quantum machines could outperform classical ones for specific problems. Its lasting importance rests on one observation: factoring looks like a number theory problem, but it can be rewritten as a problem about repeating patterns.
The idea behind it
Take a number you want to factor and pick a value smaller than it. Repeatedly multiply by that value modulo the number, and the results fall into a repeating cycle. The length of that cycle, called the period, is the hidden structure the algorithm hunts for. Once the period is known, a short classical calculation, using nothing more exotic than greatest common divisors, turns it into the actual factors.
Read more
Finding the period by brute force is hopeless for large numbers. This is where quantum mechanics enters. A quantum register can hold many values at once in superposition, and the algorithm arranges for the pattern of the period to be encoded across them. A step built on the quantum Fourier transform then causes the useful information to reinforce itself and the rest to cancel out, in the same way interfering waves amplify in some directions and fade in others. Measurement returns a single value, and classical continued fractions recover the period from it.
What it covers
- Integer factoring, the best-known application.
- The discrete logarithm problem, a close relative that underlies several other encryption schemes.
- The same machinery, adapted, applies to discrete logarithms over elliptic curves.
Symmetric encryption is affected far less directly by this algorithm; other quantum techniques bear on that, so it is worth keeping the two discussions separate in your head.
What beginners should know
You do not need a physics degree to follow the outline. The classical parts are the friendliest entry point: modular arithmetic, periodicity, continued fractions, and why a period yields a factor. From there, work through superposition, entanglement, phase, and interference in that order, then the quantum Fourier transform, which is the genuine technical heart of the method.
Practically, remember that the algorithm needs a large, error-corrected quantum computer with millions of reliable operations, and no such machine exists yet. Small instances can be simulated or run on toy hardware, usually with heavy classical shortcuts, so treat dramatic headlines with care. What the algorithm really offers today is a target: a clear statement of what quantum hardware must eventually achieve, and a reason the world is quietly redesigning its encryption.