BREAKING NEWS
Shor's algorithm

## Summary

Shor's algorithm is a polynomial-time quantum computer algorithm for integer factorization.[1] Informally, it solves the following problem: Given an integer ${\displaystyle N}$, find its prime factors. It was discovered in 1994 by the American mathematician Peter Shor.

On a quantum computer, to factor an integer ${\displaystyle N}$, Shor's algorithm runs in polynomial time (the time taken is polynomial in ${\displaystyle \log N}$, the size of the integer given as input).[2] Specifically, it takes quantum gates of order ${\displaystyle O\!\left((\log N)^{2}(\log \log N)(\log \log \log N)\right)}$ using fast multiplication,[3] thus demonstrating that the integer-factorization problem can be efficiently solved on a quantum computer and is consequently in the complexity class BQP. This is almost exponentially faster than the most efficient known classical factoring algorithm, the general number field sieve, which works in sub-exponential time: ${\displaystyle O\!\left(e^{1.9(\log N)^{1/3}(\log \log N)^{2/3}}\right)}$.[4] The efficiency of Shor's algorithm is due to the efficiency of the quantum Fourier transform, and modular exponentiation by repeated squarings.[5]

If a quantum computer with a sufficient number of qubits could operate without succumbing to quantum noise and other quantum-decoherence phenomena, then Shor's algorithm could be used to break public-key cryptography schemes, such as

• The RSA scheme
• The Finite Field Diffie-Hellman key exchange
• The Elliptic Curve Diffie-Hellman key exchange[6]

RSA is based on the assumption that factoring large integers is computationally intractable. As far as is known, this assumption is valid for classical (non-quantum) computers; no classical algorithm is known that can factor integers in polynomial time. However, Shor's algorithm shows that factoring integers is efficient on an ideal quantum computer, so it may be feasible to defeat RSA by constructing a large quantum computer. It was also a powerful motivator for the design and construction of quantum computers, and for the study of new quantum-computer algorithms. It has also facilitated research on new cryptosystems that are secure from quantum computers, collectively called post-quantum cryptography.

In 2001, Shor's algorithm was demonstrated by a group at IBM, who factored ${\displaystyle 15}$ into ${\displaystyle 3\times 5}$, using an NMR implementation of a quantum computer with ${\displaystyle 7}$ qubits.[7] After IBM's implementation, two independent groups implemented Shor's algorithm using photonic qubits, emphasizing that multi-qubit entanglement was observed when running the Shor's algorithm circuits.[8][9] In 2012, the factorization of ${\displaystyle 15}$ was performed with solid-state qubits.[10] Also, in 2012, the factorization of ${\displaystyle 21}$ was achieved, setting the record for the largest integer factored with Shor's algorithm.[11] In 2019 an attempt was made to factor the number 35 using Shor's algorithm on an IBM Q System One, but the algorithm failed because of accumulating errors.[12] Though larger numbers have been factored by quantum computers using other algorithms,[13] these algorithms are similar to classical brute-force checking of factors, so unlike Shor's algorithm, they are not expected to ever perform better than classical factoring algorithms.[14]

## Procedure

The problem that we are trying to solve is, given a composite number ${\displaystyle N}$, to find a non-trivial divisor of ${\displaystyle N}$ (a divisor strictly between ${\displaystyle 1}$ and ${\displaystyle N}$). Before attempting to find such a divisor, one can use relatively quick primality-testing algorithms to verify that ${\displaystyle N}$ is indeed composite.

We need ${\displaystyle N}$ to be odd (otherwise ${\displaystyle 2}$ is a divisor) and not to be any power of a prime (otherwise that prime is a divisor), so we need to check that there are no integer roots ${\displaystyle {\sqrt[{k}]{N}}}$ for ${\displaystyle 2\leq k\leq {\log _{3}}(N)}$.

Hence we may assume that ${\displaystyle N}$ is the product of two coprime integers greater than ${\displaystyle 2}$. It follows from the Chinese remainder theorem that there are at least four distinct square roots of ${\displaystyle 1}$ modulo ${\displaystyle N}$ (since there are two roots for each modular equation). The aim of the algorithm is to find a square root ${\displaystyle b}$ of ${\displaystyle 1}$ modulo ${\displaystyle N}$ that is different from ${\displaystyle 1}$ and ${\displaystyle -1}$, because then

${\displaystyle b^{2}-1=(b+1)(b-1)=mN}$

for a non-zero integer ${\displaystyle m}$ that gives us the non-trivial divisors ${\displaystyle \gcd(N,b+1)}$ and ${\displaystyle \gcd(N,b-1)}$ of ${\displaystyle N}$. This idea is similar to other factoring algorithms, such as the quadratic sieve.

In turn, finding such a ${\displaystyle b}$ is reduced to finding an element ${\displaystyle a}$ of even period with a certain additional property (as explained below, it is required that the condition of Step 6 of the classical part does not hold). The quantum algorithm is used for finding the period of randomly chosen elements ${\displaystyle a}$, as this is a difficult problem on a classical computer.

Shor's algorithm consists of two parts:

1. A reduction, which can be done on a classical computer, of the factoring problem to the problem of order-finding.
2. A quantum algorithm to solve the order-finding problem.

### Classical part

1. Pick a random number ${\displaystyle 1.
2. Compute ${\displaystyle K=\gcd(a,N)}$, the greatest common divisor of ${\displaystyle a}$ and ${\displaystyle N}$. This may be done using the Euclidean algorithm.
3. If ${\displaystyle K\neq 1}$, then ${\displaystyle K}$ is a nontrivial factor of ${\displaystyle N}$, so we are done.
4. Otherwise, use the quantum period-finding subroutine (below) to find ${\displaystyle r}$, which denotes the period of the following function:
${\displaystyle f(x)=a^{x}{\bmod {N}}.}$
This is the order ${\displaystyle r}$ of ${\displaystyle a}$ in the group ${\displaystyle (\mathbb {Z} _{N})^{\times }}$, which is the smallest positive integer ${\displaystyle r}$ for which ${\displaystyle f(x+r)=f(x)}$, or ${\displaystyle f(x+r)=a^{x+r}{\bmod {N}}\equiv a^{x}{\bmod {N}}}$. By Euler's Theorem, ${\displaystyle r}$ divides ${\displaystyle \varphi (N)}$, where ${\displaystyle \varphi }$ denotes Euler's totient function.
5. If ${\displaystyle r}$ is odd, then go back to step 1.
6. If ${\displaystyle a^{r/2}\equiv -1({\bmod {N}})}$, then go back to step 1.
7. Otherwise, both ${\displaystyle \gcd(a^{r/2}+1,N)}$ and ${\displaystyle \gcd(a^{r/2}-1,N)}$ are nontrivial factors of ${\displaystyle N}$, so we are done.

For example: Given ${\displaystyle N=15}$, ${\displaystyle a=7}$, and ${\displaystyle r=4}$, we have ${\displaystyle \gcd(7^{2}\pm 1,15)=\gcd(49\pm 1,15)}$, where ${\displaystyle \gcd(48,15)=3}$ and ${\displaystyle \gcd(50,15)=5}$. For ${\displaystyle N}$ that is a product of two distinct primes, ${\displaystyle p}$ and ${\displaystyle q}$, the value of ${\displaystyle \varphi (N)}$ is just ${\displaystyle N-p-q+1}$, which for ${\displaystyle N=15}$ is ${\displaystyle 8}$, and ${\displaystyle r}$ divides ${\displaystyle 8}$.

### Quantum part: period-finding subroutine

Quantum subroutine in Shor's algorithm

The quantum circuits used for this algorithm are custom designed for each choice of ${\displaystyle N}$ and each choice of the random ${\displaystyle a}$ used in ${\displaystyle f(x)=a^{x}{\bmod {N}}}$. Given ${\displaystyle N}$, find ${\displaystyle Q=2^{q}}$ such that ${\displaystyle N^{2}\leq Q<2N^{2}}$, which implies that ${\displaystyle {\dfrac {Q}{r}}>N}$. The input and output qubit registers need to hold superpositions of values from ${\displaystyle 0}$ to ${\displaystyle Q-1}$, and so have ${\displaystyle q}$ qubits each. Using what might appear to be twice as many qubits as necessary guarantees that there are at least ${\displaystyle N}$ different values of ${\displaystyle x}$ that produce the same ${\displaystyle f(x)}$, even as the period ${\displaystyle r}$ approaches ${\displaystyle {\dfrac {N}{2}}}$.

Proceed as follows:

1. Initialize the registers to
${\displaystyle {\frac {1}{\sqrt {Q}}}\sum _{x=0}^{Q-1}|x\rangle =\left({\frac {1}{\sqrt {2}}}\sum _{x_{1}=0}^{1}|x_{1}\rangle \right)\otimes \cdots \otimes \left({\frac {1}{\sqrt {2}}}\sum _{x_{q}=0}^{1}|x_{q}\rangle \right).}$

where ${\displaystyle \otimes }$ denotes the tensor product.

This initial state is a superposition of ${\displaystyle Q}$ states, and is easily obtained by generating ${\displaystyle q}$ independent qubits, each a superposition of ${\displaystyle 0}$ and ${\displaystyle 1}$ states. We can accomplish this by initializing the qubits to the zero-position, and then applying the Hadamard gate in parallel to each of the ${\displaystyle q}$ qubits, where ${\displaystyle 2^{q}=Q}$.
2. Construct ${\displaystyle f(x)}$ as a quantum function and apply it to the above state, to obtain
${\displaystyle U_{f}|x,0^{q}\rangle =|x,f(x)\rangle }$
${\displaystyle U_{f}{\frac {1}{\sqrt {Q}}}\sum _{x=0}^{Q-1}|x,0^{q}\rangle ={\frac {1}{\sqrt {Q}}}\sum _{x=0}^{Q-1}|x,f(x)\rangle }$
This is still a superposition of ${\displaystyle Q}$ states. However, the ${\displaystyle q+n}$ qubits, i.e, the ${\displaystyle q}$ input qubits and ${\displaystyle n}$ (${\displaystyle >{\log _{2}}(N)}$) output qubits, are now entangled or not separable, as the state cannot be written as a tensor product of states of individual qubits. Importantly, the value containing the ${\displaystyle r}$ we are looking for is now stored in the phase of the input qubits ${\displaystyle x}$ as a result of "phase kickback", where using qubits as control inputs to unitary gates alters the relative phase of the control qubits.[15]
3. Apply the inverse quantum Fourier transform to the input register. This transform (operating on a superposition of ${\displaystyle Q=2^{q}}$ states) uses a ${\displaystyle Q}$-th root of unity such as ${\displaystyle \omega =e^{\frac {2\pi i}{Q}}}$ to distribute the amplitude of any given ${\displaystyle |x\rangle }$ state equally among all ${\displaystyle Q}$ of the ${\displaystyle |y\rangle }$ states, and to do so in a different way for each different ${\displaystyle x}$. We thus obtain
${\displaystyle {U_{\operatorname {QFT} }}(|x\rangle )={\frac {1}{\sqrt {Q}}}\sum _{y=0}^{Q-1}\omega ^{xy}|y\rangle .}$
This leads to the final state
${\displaystyle {\frac {1}{Q}}\sum _{x=0}^{Q-1}\sum _{y=0}^{Q-1}\omega ^{xy}|y,f(x)\rangle .}$
Now, we reorder this sum as
${\displaystyle {\frac {1}{Q}}\sum _{z=0}^{N-1}\sum _{y=0}^{Q-1}\left[\sum _{x\in \{0,\ldots ,Q-1\};~f(x)=z}\omega ^{xy}\right]|y,z\rangle .}$
This is a superposition of many more than ${\displaystyle Q}$ states, but many fewer than ${\displaystyle Q^{2}}$ states, as there are fewer than ${\displaystyle Q}$ distinct values of ${\displaystyle z=f(x)}$. Let
• ${\displaystyle \omega =e^{\frac {2\pi i}{Q}}}$ be a ${\displaystyle Q}$-th root of unity,
• ${\displaystyle r}$ be the period of ${\displaystyle f}$,
• ${\displaystyle x_{0}}$ be the smallest of the ${\displaystyle x\in \{0,\ldots ,Q-1\}}$ for which ${\displaystyle f(x)=z}$ (we have ${\displaystyle x_{0}), and
• write ${\displaystyle m-1=\left\lfloor {\frac {Q-x_{0}-1}{r}}\right\rfloor }$
• ${\displaystyle b}$ indexes these ${\displaystyle x}$, running from ${\displaystyle 0}$ to ${\displaystyle m-1}$, so that ${\displaystyle x_{0}+rb.
Then ${\displaystyle \omega ^{ry}}$ is a unit vector in the complex plane (${\displaystyle \omega }$ is a root of unity, and ${\displaystyle r}$ and ${\displaystyle y}$ are integers), and the coefficient of ${\displaystyle {\dfrac {1}{Q}}\left|y,z\right\rangle }$ in the final state is
${\displaystyle \sum _{x\in \{0,\ldots ,Q-1\};~f(x)=z}\omega ^{xy}=\sum _{b=0}^{m-1}\omega ^{(x_{0}+rb)y}=\omega ^{x_{0}y}\sum _{b=0}^{m-1}\omega ^{rby}.}$
Each term in this sum represents a different path to the same result, and quantum interference occurs — constructive when the unit vectors ${\displaystyle \omega ^{ryb}}$ point in nearly the same direction in the complex plane, which requires that ${\displaystyle \omega ^{ry}}$ point along the positive real axis.
4. Perform a measurement. We obtain some outcome ${\displaystyle y}$ in the input register and some outcome ${\displaystyle z}$ in the output register. As ${\displaystyle f}$ is periodic, the probability of measuring some state ${\displaystyle |y,z\rangle }$ is given by
${\displaystyle \mathrm {Pr} (|y,z\rangle )=\left|{\frac {1}{Q}}\sum _{x\in \{0,\ldots ,Q-1\};~f(x)=z}\omega ^{xy}\right|^{2}={\frac {1}{Q^{2}}}\left|\sum _{b=0}^{m-1}\omega ^{(x_{0}+rb)y}\right|^{2}={\frac {1}{Q^{2}}}|\omega ^{x_{0}y}|^{2}\left|\sum _{b=0}^{m-1}\omega ^{bry}\right|^{2}}$
${\displaystyle ={\frac {1}{Q^{2}}}\left|\sum _{b=0}^{m-1}\omega ^{bry}\right|^{2}={\frac {1}{Q^{2}}}\left|{\frac {\omega ^{mry}-1}{\omega ^{ry}-1}}\right|^{2}={\frac {1}{Q^{2}}}{\frac {\sin ^{2}({\frac {\pi mry}{Q}})}{\sin ^{2}({\frac {\pi ry}{Q}})}}}$
Analysis now shows that this probability is higher the closer the unit vector ${\displaystyle \omega ^{ry}}$ is to the positive real axis, or the closer ${\displaystyle {\dfrac {yr}{Q}}}$ is to an integer. Unless ${\displaystyle r}$ is a power of ${\displaystyle 2}$, it will not be a factor of ${\displaystyle Q}$.
5. Since ${\displaystyle {\frac {yr}{Q}}}$ is close to some integer ${\displaystyle c}$, the known value ${\displaystyle {\dfrac {y}{Q}}}$ is close to the unknown value ${\displaystyle {\dfrac {c}{r}}}$. Performing [classical] continued fraction expansion on ${\displaystyle {\dfrac {y}{Q}}}$ allows us to find approximations ${\displaystyle {\dfrac {d}{s}}}$ of it that satisfy two conditions:
1. ${\displaystyle s.
2. ${\displaystyle \left|{\dfrac {y}{Q}}-{\dfrac {d}{s}}\right|<{\dfrac {1}{2Q}}}$.
Given these multiple conditions (and assuming ${\displaystyle {\dfrac {d}{s}}}$ is irreducible), ${\displaystyle s}$ is very likely to be the appropriate period ${\displaystyle r}$, or at least a factor of it.
6. Check (classically) if ${\displaystyle f(x)=f(x+s)\Leftrightarrow a^{s}\equiv 1{\bmod {N}}}$. If so, then we are done.
7. Otherwise, (classically) obtain more candidates for ${\displaystyle r}$ by using multiples of ${\displaystyle s}$, or by using other ${\displaystyle s}$ with ${\displaystyle {\dfrac {d}{s}}}$ near ${\displaystyle {\dfrac {y}{Q}}}$. If any candidate works, then we are done.
8. Otherwise, try again starting from step 1 of this subroutine.

## Explanation of the algorithm

The algorithm is composed of two parts. The first part of the algorithm turns the factoring problem into the problem of finding the period of a function and may be implemented classically. The second part finds the period using the quantum Fourier transform and is responsible for the quantum speedup.

### Obtaining factors from period

The integers less than ${\displaystyle N}$ and coprime with ${\displaystyle N}$ form the multiplicative group of integers modulo ${\displaystyle N}$, which is a finite abelian group ${\displaystyle G}$. The size of this group is given by ${\displaystyle \varphi (N)}$. By the end of step 3, we have an integer ${\displaystyle a}$ in this group. As the group is finite, ${\displaystyle a}$ must have a finite order ${\displaystyle r}$, which is the smallest positive integer such that

${\displaystyle a^{r}\equiv 1{\bmod {N}}.}$

Therefore, ${\displaystyle N}$ divides ${\displaystyle a^{r}-1}$ (also written ${\displaystyle N\mid a^{r}-1}$). Suppose that we are able to obtain ${\displaystyle r}$ and that it is even. (If ${\displaystyle r}$ is odd, then by step 5, we have to restart the algorithm with a different random number ${\displaystyle a}$) Now ${\displaystyle b\equiv a^{r/2}{\bmod {N}}}$ is a square root of ${\displaystyle 1}$ modulo ${\displaystyle N}$ that is different from ${\displaystyle 1}$. This is because ${\displaystyle r}$ is the order of ${\displaystyle a}$ modulo ${\displaystyle N}$, so ${\displaystyle a^{r/2}\not \equiv 1{\bmod {N}}}$, or else the order of ${\displaystyle a}$ in this group would be ${\displaystyle {\dfrac {r}{2}}}$. If ${\displaystyle a^{r/2}\equiv -1{\bmod {N}}}$, then by step 6, we have to restart the algorithm with a different random number ${\displaystyle a}$.

Eventually, we must hit an ${\displaystyle a}$ of order ${\displaystyle r}$ in ${\displaystyle G}$ such that ${\displaystyle b\equiv a^{r/2}\not \equiv \pm 1{\bmod {N}}}$. This is because such a ${\displaystyle b}$ is a square root of ${\displaystyle 1}$ modulo ${\displaystyle N}$ other than ${\displaystyle 1}$ and ${\displaystyle -1}$, whose existence is guaranteed by the Chinese remainder theorem, as ${\displaystyle N}$ is not a prime power.

We claim that ${\displaystyle d=\gcd(b-1,N)}$ is a proper factor of ${\displaystyle N}$, i.e., ${\displaystyle d\neq 1,N}$. In fact, if ${\displaystyle d=N}$, then ${\displaystyle N}$ divides ${\displaystyle b-1}$, so that ${\displaystyle b\equiv 1{\bmod {N}}}$, which goes against the construction of ${\displaystyle b}$. If, on the other hand, ${\displaystyle d=\gcd(b-1,N)=1}$, then by Bézout's identity, there are integers ${\displaystyle u,v}$ such that

${\displaystyle (b-1)u+Nv=1.}$

Multiplying both sides by ${\displaystyle b+1}$, we obtain

${\displaystyle (b^{2}-1)u+N(b+1)v=b+1.}$

As ${\displaystyle N}$ divides ${\displaystyle b^{2}-1\equiv a^{r}-1{\bmod {N}}}$, we find that ${\displaystyle N}$ divides ${\displaystyle b+1}$, so that ${\displaystyle b\equiv -1{\bmod {N}}}$, again contradicting the construction of ${\displaystyle b}$.

Therefore, ${\displaystyle d}$ is the required proper factor of ${\displaystyle N}$.

### Finding the period

Shor's period-finding algorithm relies heavily on the ability of a quantum computer to be in many states simultaneously.

Physicists call this behavior a "superposition" of states. To compute the period of a function ${\displaystyle f}$, we evaluate the function at all points simultaneously.

Quantum physics does not allow us to access all this information directly, however. A measurement will yield only one of all possible values, destroying all others. If not for the no-cloning theorem, we could first measure ${\displaystyle f(x)}$ without measuring ${\displaystyle x}$, and then make a few copies of the resulting state (which is a superposition of states all having the same ${\displaystyle f(x)}$). Measuring ${\displaystyle x}$ on these states would provide different ${\displaystyle x}$ values which give the same ${\displaystyle f(x)}$, leading to the period. Because we cannot make exact copies of a quantum state, this method does not work. Therefore, we have to carefully transform the superposition to another state that will return the correct answer with high probability. This is achieved by the quantum Fourier transform.

Shor thus had to solve three "implementation" problems. All of them had to be implemented "fast", which means that they can be implemented with a number of quantum gates that is polynomial in ${\displaystyle \log N}$.

1. Create a superposition of states. This can be done by applying Hadamard gates to all qubits in the input register. Another approach would be to use the quantum Fourier transform (see below).
2. Implement the function ${\displaystyle f}$ as a quantum transform. To achieve this, Shor used repeated squaring for his modular exponentiation transformation. It is important to note that this step is more difficult to implement than the quantum Fourier transform, in that it requires ancillary qubits and substantially more gates to accomplish.
3. Perform a quantum Fourier transform. By using controlled rotation gates and Hadamard gates, Shor designed a circuit for the quantum Fourier transform (with ${\displaystyle Q=2^{q}}$) that uses just ${\displaystyle {\dfrac {q(q-1)}{2}}=O\!\left((\log Q)^{2}\right)}$ gates.[16]

After all these transformations, a measurement will yield an approximation to the period ${\displaystyle r}$. For simplicity assume that there is a ${\displaystyle y}$ such that ${\displaystyle {\dfrac {yr}{Q}}}$ is an integer. Then the probability to measure ${\displaystyle y}$ is ${\displaystyle 1}$. To see this, we notice that then

${\displaystyle e^{-{\frac {2\pi ibyr}{Q}}}=1}$

for all integers ${\displaystyle b}$. Therefore, the sum whose square gives us the probability to measure ${\displaystyle y}$ will be ${\displaystyle {\dfrac {Q}{r}}}$, as ${\displaystyle b}$ takes roughly ${\displaystyle {\dfrac {Q}{r}}}$ values and thus the probability is ${\displaystyle {\dfrac {1}{r^{2}}}}$. There are ${\displaystyle r}$ possible values of ${\displaystyle y}$ such that ${\displaystyle {\dfrac {yr}{Q}}}$ is an integer, and also ${\displaystyle r}$ possibilities for ${\displaystyle f(x_{0})}$, so the probabilities sum to ${\displaystyle 1}$.

Note: Another way to explain Shor's algorithm is by noting that it is just the quantum phase estimation algorithm in disguise.

### The bottleneck

The runtime bottleneck of Shor's algorithm is quantum modular exponentiation, which is by far slower than the quantum Fourier transform and classical pre-/post-processing. There are several approaches to constructing and optimizing circuits for modular exponentiation. The simplest and (currently) most practical approach is to mimic conventional arithmetic circuits with reversible gates, starting with ripple-carry adders. Knowing the base and the modulus of exponentiation facilitates further optimizations.[17][18] Reversible circuits typically use on the order of ${\displaystyle n^{3}}$ gates for ${\displaystyle n}$ qubits. Alternative techniques asymptotically improve gate counts by using quantum Fourier transforms, but are not competitive with fewer than 600 qubits owing to high constants.

## Discrete logarithms

Given a group ${\displaystyle G}$ with order ${\displaystyle p}$ and generator ${\displaystyle g\in G}$, suppose we know that ${\displaystyle x=g^{r}\in G}$, for some ${\displaystyle r\in \mathbb {Z} _{p}}$, and we wish to compute ${\displaystyle r}$, which is the discrete logarithm: ${\displaystyle r={\log _{g}}(x)}$. Consider the abelian group ${\displaystyle \mathbb {Z} _{p}\times \mathbb {Z} _{p}}$, where each factor corresponds to modular addition of values. Now, consider the function

${\displaystyle f\colon \mathbb {Z} _{p}\times \mathbb {Z} _{p}\to G\;;\;f(a,b)=g^{a}x^{-b}.}$

This gives us an abelian hidden subgroup problem, as ${\displaystyle f}$ corresponds to a group homomorphism. The kernel corresponds to the multiples of ${\displaystyle (r,1)}$. So, if we can find the kernel, we can find ${\displaystyle r}$.

## References

1. ^ Shor, P.W. (1994). "Algorithms for quantum computation: discrete logarithms and factoring". Proceedings 35th Annual Symposium on Foundations of Computer Science. IEEE Comput. Soc. Press: 124–134. doi:10.1109/sfcs.1994.365700. ISBN 0818665807. S2CID 15291489.
3. ^ Beckman, David; Chari, Amalavoyal N.; Devabhaktuni, Srikrishna; Preskill, John (1996). "Efficient Networks for Quantum Factoring" (PDF). Physical Review A. 54 (2): 1034–1063. arXiv:quant-ph/9602016. Bibcode:1996PhRvA..54.1034B. doi:10.1103/PhysRevA.54.1034. PMID 9913575. S2CID 2231795.
4. ^ "Number Field Sieve". wolfram.com. Retrieved 23 October 2015.
5. ^ Gidney, Craig. "Shor's Quantum Factoring Algorithm". Algorithmic Assertions. Retrieved 28 November 2020.
6. ^ Roetteler; et al. "Quantum resource estimates for computing elliptic curve discrete logarithms". arxiv.org.
7. ^ Vandersypen, Lieven M. K.; Steffen, Matthias; Breyta, Gregory; Yannoni, Costantino S.; Sherwood, Mark H. & Chuang, Isaac L. (2001), "Experimental realization of Shor's quantum factoring algorithm using nuclear magnetic resonance" (PDF), Nature, 414 (6866): 883–887, arXiv:quant-ph/0112176, Bibcode:2001Natur.414..883V, CiteSeerX 10.1.1.251.8799, doi:10.1038/414883a, PMID 11780055, S2CID 4400832
8. ^ Lu, Chao-Yang; Browne, Daniel E.; Yang, Tao & Pan, Jian-Wei (2007), "Demonstration of a Compiled Version of Shor's Quantum Factoring Algorithm Using Photonic Qubits" (PDF), Physical Review Letters, 99 (25): 250504, arXiv:0705.1684, Bibcode:2007PhRvL..99y0504L, doi:10.1103/PhysRevLett.99.250504, PMID 18233508, S2CID 5158195
9. ^ Lanyon, B. P.; Weinhold, T. J.; Langford, N. K.; Barbieri, M.; James, D. F. V.; Gilchrist, A. & White, A. G. (2007), "Experimental Demonstration of a Compiled Version of Shor's Algorithm with Quantum Entanglement" (PDF), Physical Review Letters, 99 (25): 250505, arXiv:0705.1398, Bibcode:2007PhRvL..99y0505L, doi:10.1103/PhysRevLett.99.250505, hdl:10072/21608, PMID 18233509, S2CID 10010619
10. ^ Lucero, Erik; Barends, Rami; Chen, Yu; Kelly, Julian; Mariantoni, Matteo; Megrant, Anthony; O'Malley, Peter; Sank, Daniel; Vainsencher, Amit; Wenner, James; White, Ted; Yin, Yi; Cleland, Andrew N.; Martinis, John M. (2012). "Computing prime factors with a Josephson phase qubit quantum processor". Nature Physics. 8 (10): 719. arXiv:1202.5707. Bibcode:2012NatPh...8..719L. doi:10.1038/nphys2385. S2CID 44055700.
11. ^ Martín-López, Enrique; Martín-López, Enrique; Laing, Anthony; Lawson, Thomas; Alvarez, Roberto; Zhou, Xiao-Qi; O'Brien, Jeremy L. (12 October 2012). "Experimental realization of Shor's quantum factoring algorithm using qubit recycling". Nature Photonics. 6 (11): 773–776. arXiv:1111.4147. Bibcode:2012NaPho...6..773M. doi:10.1038/nphoton.2012.259. S2CID 46546101.
12. ^ Amico, Mirko; Saleem, Zain H.; Kumph, Muir (2019-07-08). "An Experimental Study of Shor's Factoring Algorithm on IBM Q". Physical Review A. 100 (1): 012305. arXiv:1903.00768. doi:10.1103/PhysRevA.100.012305. ISSN 2469-9926. S2CID 92987546.
13. ^ Karamlou, Amir H.; Simon, William A.; Katabarwa, Amara; Scholten, Travis L.; Peropadre, Borja; Cao, Yudong (2021-10-28). "Analyzing the performance of variational quantum factoring on a superconducting quantum processor". npj Quantum Information. 7 (1): 1–6. arXiv:2012.07825. doi:10.1038/s41534-021-00478-z. ISSN 2056-6387.
14. ^ "Quantum computing motte-and-baileys". Shtetl-Optimized. 2019-12-28. Retrieved 2021-11-15.
15. ^ Qiskit authors. "Qiskit Textbook: Quantum Phase Estimation". IBM. Retrieved 7 November 2020.
16. ^ Shor 1999, p. 14
17. ^ Markov, Igor L.; Saeedi, Mehdi (2012). "Constant-Optimized Quantum Circuits for Modular Multiplication and Exponentiation". Quantum Information and Computation. 12 (5–6): 361–394. arXiv:1202.6614. Bibcode:2012arXiv1202.6614M. doi:10.26421/QIC12.5-6-1. S2CID 16595181.
18. ^ Markov, Igor L.; Saeedi, Mehdi (2013). "Faster Quantum Number Factoring via Circuit Synthesis". Phys. Rev. A. 87 (1): 012310. arXiv:1301.3210. Bibcode:2013PhRvA..87a2310M. doi:10.1103/PhysRevA.87.012310. S2CID 2246117.
19. ^ Bernstein, Daniel J.; Heninger, Nadia; Lou, Paul; Valenta, Luke (2017). "Post-quantum RSA" (PDF). International Workshop on Post-Quantum Cryptography. Lecture Notes in Computer Science. 10346: 311–329. doi:10.1007/978-3-319-59879-6_18. ISBN 978-3-319-59878-9. Archived (PDF) from the original on 2017-04-20.

• Nielsen, Michael A. & Chuang, Isaac L. (2010), Quantum Computation and Quantum Information, 10th Anniversary Edition, Cambridge University Press, ISBN 9781107002173.
• Phillip Kaye, Raymond Laflamme, Michele Mosca, An introduction to quantum computing, Oxford University Press, 2007, ISBN 0-19-857049-X
• "Explanation for the man in the street" by Scott Aaronson, "approved" by Peter Shor. (Shor wrote "Great article, Scott! That’s the best job of explaining quantum computing to the man on the street that I’ve seen."). An alternate metaphor for the QFT was presented in one of the comments. Scott Aaronson suggests the following 12 references as further reading (out of "the 10105000 quantum algorithm tutorials that are already on the web."):
• Shor, Peter W. (1997), "Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer", SIAM J. Comput., 26 (5): 1484–1509, arXiv:quant-ph/9508027v2, Bibcode:1999SIAMR..41..303S, doi:10.1137/S0036144598347011. Revised version of the original paper by Peter Shor ("28 pages, LaTeX. This is an expanded version of a paper that appeared in the Proceedings of the 35th Annual Symposium on Foundations of Computer Science, Santa Fe, NM, Nov. 20--22, 1994. Minor revisions made January, 1996").
• Quantum Computing and Shor's Algorithm, Matthew Hayward's Quantum Algorithms Page, 2005-02-17, imsa.edu, LaTeX2HTML version of the original LaTeX document, also available as PDF or postscript document.
• Quantum Computation and Shor's Factoring Algorithm, Ronald de Wolf, CWI and University of Amsterdam, January 12, 1999, 9 page postscript document.
• Shor's Factoring Algorithm, Notes from Lecture 9 of Berkeley CS 294–2, dated 4 Oct 2004, 7 page postscript document.
• Chapter 6 Quantum Computation, 91 page postscript document, Caltech, Preskill, PH229.
• Quantum computation: a tutorial by Samuel L. Braunstein.
• The Quantum States of Shor's Algorithm, by Neal Young, Last modified: Tue May 21 11:47:38 1996.
• III. Breaking RSA Encryption with a Quantum Computer: Shor's Factoring Algorithm, Lecture notes on Quantum computation, Cornell University, Physics 481–681, CS 483; Spring, 2006 by N. David Mermin. Last revised 2006-03-28, 30 page PDF document.
• Lavor, C.; Manssur, L. R. U.; Portugal, R. (2003). "Shor's Algorithm for Factoring Large Integers". arXiv:quant-ph/0303175.
• Lomonaco, Jr (2000). "Shor's Quantum Factoring Algorithm". arXiv:quant-ph/0010034. This paper is a written version of a one-hour lecture given on Peter Shor's quantum factoring algorithm. 22 pages.
• Chapter 20 Quantum Computation, from Computational Complexity: A Modern Approach, Draft of a book: Dated January 2007, Sanjeev Arora and Boaz Barak, Princeton University. Published as Chapter 10 Quantum Computation of Sanjeev Arora, Boaz Barak, "Computational Complexity: A Modern Approach", Cambridge University Press, 2009, ISBN 978-0-521-42426-4
• A Step Toward Quantum Computing: Entangling 10 Billion Particles, from "Discover Magazine", Dated January 19, 2011.
• Josef Gruska - Quantum Computing Challenges also in Mathematics unlimited: 2001 and beyond, Editors Björn Engquist, Wilfried Schmid, Springer, 2001, ISBN 978-3-540-66913-5