Introduction: The Lock That Holds the Internet Together
Every time you log into your bank account, send an encrypted message, or load a secure web page, your data is protected by computational asymmetry [2]. It is remarkably easy for a computer to multiply two large prime numbers together to generate a massive composite number [1, 2]. However, reversing that process—taking that gigantic composite integer and extracting its original prime factors—is a computational wall [1, 2].
Modern public-key cryptography, such as RSA, rests entirely on this imbalance [2]. For classical supercomputers, factoring a 2048-bit key would require checking astronomical combinations of prime factors, a task estimated to take billions of years [2]. But why does classical computing struggle so severely with this problem, and how does quantum computing solve it in seconds?
To understand the fundamental shift between classical and quantum computing, we don't need hand-waving metaphors about parallel multiverses. Instead, we can trace exactly what happens when both classical and quantum algorithms process the exact same task: factoring the integer $N = 15$.
The Classical Approach: Checking Every Lock Key
Classical computing operates on deterministic binary logic—bits that exist strictly as $0$ or $1$ [1]. When presented with a composite number $N$, a classical processor approaches factorisation through direct arithmetic testing or algebraic sieving [1, 2].
Step 1: Trial Division and Classical Sieves
The most straightforward classical method is trial division [1]. The algorithm systematically tests prime numbers $d$ up to $\sqrt{N}$ to check if $N \bmod d = 0$ [1].
For large numbers, advanced algorithms like the General Number Field Sieve (GNFS) improve this efficiency by finding congruences of squares modulo $N$ [2]. However, regardless of the classical optimisation, the core methodology still relies on testing potential mathematical relations sequentially [1, 2].
Tracing Classical Factorisation for N = 15
Let's run a classical trial division algorithm on $N = 15$:
- Calculate Search Limit: Compute $\lfloor\sqrt{15}\rfloor = 3$. We only need to check prime numbers up to $3$.
- Test Prime 1 ($d = 2$): Check if $15 \bmod 2 = 0$. $15 = 2 \times 7 + 1$. Remainder is $1$. Not a factor.
- Test Prime 2 ($d = 3$): Check if $15 \bmod 3 = 0$. $15 = 3 \times 5 + 0$. Remainder is $0$. Factor found!
- Extract Remaining Factor: Divide $15 / 3 = 5$. Both $3$ and $5$ are prime. Algorithm completes.
For $N = 15$, trial division required just two division checks. It feels deceptively fast because $15$ is tiny.
The Scaling Problem: Exponential Growth in Time
The weakness of classical algorithms is exposed when $N$ grows [2]. A classical computer must evaluate candidate factors sequentially [1]. Adding digits to $N$ increases the key search space exponentially [2]. The GNFS algorithm runs in sub-exponential time:
$$O\left( \exp \left( c \, (\ln N)^{1/3} (\ln \ln N)^{2/3} \right) \right)$$
As a result, doubling the bit length of a key requires exponentially more computing resources and time, quickly making classical factorisation impossible [2].
The Quantum Approach: Shor’s Algorithm and Period Finding
Quantum algorithms do not simply run classical trial division at ultra-high speeds [1]. Instead, Shor's algorithm reframes the integer factorisation problem into an entirely different mathematical domain: period finding [1, 3].
Turning Factorisation into a Clock Problem (Modular Exponentiation)
In number theory, picking a random integer $a$ (where $1 < a < N$ and $\gcd(a, N) = 1$) allows us to construct a repeating sequence using modular exponentiation [1]:
$$f(x) = a^x \bmod N$$
This sequence behaves like a clock dial—as $x$ increases, the values of $f(x)$ cycle repeatedly through a fixed set of numbers [1]. The length of this repeating cycle is called the period, denoted as $r$ [1, 3]. Once we find the period $r$, number theory guarantees that if $r$ is an even number, we can easily find the factors of $N$ using the classical Greatest Common Divisor (GCD) formula [1]:
$$\text{Factors} = \gcd(a^{r/2} \pm 1, N)$$
Tracing Quantum Factorization for N = 15 (Choosing a = 7)
Let's trace how Shor’s algorithm handles $N = 15$ by picking a co-prime base $a = 7$ [1]:
- Check Co-Primes: Calculate $\gcd(7, 15) = 1$. (If GCD were greater than 1, we would have accidentally found a factor classically!)
- Construct Modular Sequence ($f(x) = 7^x \bmod 15$):
- $x = 0 \implies 7^0 \bmod 15 = 1$
- $x = 1 \implies 7^1 \bmod 15 = 7$
- $x = 2 \implies 7^2 \bmod 15 = 49 \bmod 15 = 4$
- $x = 3 \implies 7^3 \bmod 15 = 343 \bmod 15 = 13$
- $x = 4 \implies 7^4 \bmod 15 = 2401 \bmod 15 = 1$ (The sequence repeats!)
- Identify the Period ($r$): The sequence values $\{1, 7, 4, 13, 1, 7, 4, 13\dots\}$ repeat every $4$ steps. Therefore, period $r = 4$.
- Verify Period Conditions: $r = 4$ is even, and $a^{r/2} + 1 = 7^2 + 1 = 50$, which is not a multiple of $15$.
- Classical GCD Extraction:
- Factor 1: $\gcd(7^{4/2} - 1, 15) = \gcd(48, 15) = \mathbf{3}$
- Factor 2: $\gcd(7^{4/2} + 1, 15) = \gcd(50, 15) = \mathbf{5}$
Finding the period $r$ instantly gives us the prime factors! But wait: calculating $f(x)$ step-by-step for massive numbers is just as slow as classical trial division [1]. How does a quantum computer find $r$ without calculating every step individually?
How Quantum Mechanics Does the Heavy Lifting
A quantum computer evaluates the global period $r$ in polynomial time using two quantum mechanical principles: superposition and quantum interference [1, 3].
Superposition: Loading All Guesses at Once
A classical register holding $n$ bits stores a single integer from $0$ to $2^n - 1$ at any given time [1]. A quantum register of $n$ qubits, however, can exist in a simultaneous superposition of all $2^n$ computational states [1, 3].
When running Shor’s algorithm, the quantum computer initialises two registers [1]:
- Register 1 (Input $x$): Loaded into an equal superposition of all possible power values $x$.
- Register 2 (Output $f(x)$): Evaluates $a^x \bmod N$ across the superposed input register in a single quantum operation [1].
At this stage, the quantum system holds the entire modular sequence in an entangled quantum state [1, 3]. However, simply measuring Register 2 would instantly collapse the superposition into a single random outcome, destroying the quantum advantage [1, 3]. To find the repeating pattern $r$ without triggering a random collapse, the algorithm uses wave interference [1, 3].
Interference & QFT: Cancelling Noise to Extract the Period
Instead of measuring individual values, Shor's algorithm applies the Quantum Fourier Transform (QFT) to Register 1 [1, 3].
Just as a classical Fourier transform takes a complex audio signal and isolates its underlying frequency, the QFT takes the superposed states and converts periodic spatial data into phase frequencies [1, 3].
- Destructive Interference: Computational states that do not match the true period $r$ interfere destructively, cancelling each other out to zero probability [1, 3].
- Constructive Interference: States corresponding to exact multiples of the frequency $1/r$ interfere constructively, amplifying their probability amplitudes [1, 3].
When the QFT step completes and Register 1 is measured, the system collapses with near certainty into a state directly revealing the period $r$ [1, 3].
[FIGURE / DIAGRAM PLACEHOLDER]- Suggested File Name: qft-interference-period-extraction.png
- Caption: Figure 3: Conceptual diagram of the Quantum Fourier Transform converting superposed sequence states into sharp probability peaks corresponding to the period r.
- Alt-Text: Quantum wave phases cancelling out wrong answers while reinforcing constructive peaks at exact multiples of the period frequency.
The Final Step: Classical Math Extracts the Factors
Once the quantum processor measures the period $r$, it passes $r$ back to a standard classical computer [1]. The classical processor finishes the job in milliseconds using the fast Euclidean GCD algorithm [1]:
$$\gcd(a^{r/2} \pm 1, N)$$
Shor's algorithm achieves a polynomial runtime complexity of approximately $O((\log N)^3)$ [1, 3]. What takes a classical supercomputer billions of years scales down to a task solvable in a matter of hours or seconds on a sufficiently fault-tolerant quantum computer [1, 2, 3].
Comparison Summary: Classical vs. Quantum Factorisation
| Feature | Classical Factorization | Quantum Factorisation (Shor’s) |
|---|---|---|
| Core Mechanism | Sequential division / Algebraic sieves (GNFS) [1, 2] | Period finding via Modular Exponentiation + QFT [1, 3] |
| Data Unit | Binary Bits ($0$ OR $1$) [1] | Qubits (Superposition of $|0\rangle$ AND $|1\rangle$) [1, 3] |
| Primary Physics | Deterministic logic gates [1] | Superposition, Entanglement, Phase Interference [1, 3] |
| Scaling Complexity | Sub-exponential $O(\exp(c (\ln N)^{1/3} (\ln \ln N)^{2/3}))$ [2] | Polynomial $O((\log N)^3)$ [1, 3] |
| Impact on 2048-bit RSA | Intractable (Billions of years) [2] | Solvable (Minutes to Hours) [1, 2] |
Conclusion: What This Means for the Future of Computing
Tracing $N = 15$ highlights why quantum computers are fundamentally different from classical machines. Quantum speedup does not stem from brute-force parallel processing [1, 3]. Instead, it comes from restructuring mathematical problems so that quantum interference can isolate structural patterns—like periods—exponentially faster than sequential checking [1, 3].
While building fault-tolerant quantum hardware capable of running Shor's algorithm on 2048-bit numbers remains an ongoing engineering challenge, the theoretical foundation is sound [1, 2, 3]. Understanding these mechanics allows us to appreciate both the elegance of quantum algorithms and the urgent modern transition toward Post-Quantum Cryptography (PQC) [2].
References & Suggested Reading
- Nielsen, M. A., & Chuang, I. L. (2010). Quantum Computation and Quantum Information (10th Anniversary ed.). Cambridge University Press. https://doi.org/10.1017/CBO9780511976667
- Cormen, T. H., Leiserson, C. E., Rivest, R. L., & Stein, C. (2022). Introduction to Algorithms (4th ed.). MIT Press.
- Shor, P. W. (1994). Algorithms for quantum computation: discrete logarithms and factoring. Proceedings 35th Annual Symposium on Foundations of Computer Science, 124–134. https://doi.org/10.1109/SFCS.1994.365700
Comments
Post a Comment