Shor's algorithm

From HandWiki
Short description: Quantum algorithm for integer factorization

Shor's algorithm is a quantum algorithm for finding the prime factors of an integer. It was developed in 1994 by the American mathematician Peter Shor.[1][2] It is one of the few known quantum algorithms with compelling potential applications and strong evidence of superpolynomial speedup compared to best known classical (that is, non-quantum) algorithms.[3] On the other hand, factoring numbers of practical significance requires far more qubits than available in the near future.[4] Another concern is that noise in quantum circuits may undermine results,[5] requiring additional qubits for quantum error correction.

Shor proposed multiple similar algorithms solving the factoring problem, the discrete logarithm problem, and the period finding problem. "Shor's algorithm" usually refers to his algorithm solving factoring, but may also refer to each of the three. The discrete logarithm algorithm and the factoring algorithm are instances of the period finding algorithm, and all three are instances of the hidden subgroup problem.

On a quantum computer, to factor an integer [math]\displaystyle{ N }[/math], Shor's algorithm runs in polynomial time, meaning the time taken is polynomial in [math]\displaystyle{ \log N }[/math], the size of the integer given as input.[6] Specifically, it takes quantum gates of order [math]\displaystyle{ O \! \left((\log N)^{2} (\log \log N) (\log \log \log N) \right) }[/math] using fast multiplication,[7] or even [math]\displaystyle{ O \! \left((\log N)^{2} (\log \log N) \right) }[/math] utilizing the asymptotically fastest multiplication algorithm currently known due to Harvey and Van Der Hoven,[8] 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 significantly faster than the most efficient known classical factoring algorithm, the general number field sieve, which works in sub-exponential time: [math]\displaystyle{ O \! \left(e^{1.9 (\log N)^{1/3} (\log \log N)^{2/3}} \right) }[/math].[9]

Feasibility and impact

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[10]

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.

Physical implementation

Given the high error rates of contemporary quantum computers and too few qubits to use quantum error correction, laboratory demonstrations obtain correct results only in a fraction of attempts.

In 2001, Shor's algorithm was demonstrated by a group at IBM, who factored [math]\displaystyle{ 15 }[/math] into [math]\displaystyle{ 3 \times 5 }[/math], using an NMR implementation of a quantum computer with seven qubits.[11] 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.[12][13] In 2012, the factorization of [math]\displaystyle{ 15 }[/math] was performed with solid-state qubits.[14] Later, in 2012, the factorization of [math]\displaystyle{ 21 }[/math] was achieved.[15] In 2019, an attempt was made to factor the number [math]\displaystyle{ 35 }[/math] using Shor's algorithm on an IBM Q System One, but the algorithm failed because of accumulating errors.[16] Though larger numbers have been factored by quantum computers using other algorithms,[17] 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.[18]

Theoretical analyses of Shor's algorithm assume a quantum computer free of noise and errors. However, near-term practical implementations will have to deal with such undesired phenomena (when more qubits are available, Quantum error correction can help). In 2023, Jin-Yi Cai studied the impact of noise and concluded that there is a special class of numbers (products of two primes from A073024, which are dense in the semiprimes), Shor's algorithm cannot factor such numbers in the presence of noise.[5] Hence error-correction will be needed to be able to factor all numbers with Shor's algorithm.

Algorithm

The problem that we are trying to solve is: given an odd composite number [math]\displaystyle{ N }[/math], find its integer factors.

To achieve this, Shor's algorithm consists of two parts:

  1. A classical reduction of the factoring problem to the problem of order-finding. This reduction is similar to that used for other factoring algorithms, such as the quadratic sieve.
  2. A quantum algorithm to solve the order-finding problem.

Classical reduction

A complete factoring algorithm is possible if we're able to efficiently factor arbitrary [math]\displaystyle{ N }[/math] into just two integers [math]\displaystyle{ p }[/math] and [math]\displaystyle{ q }[/math] greater than 1, since if either [math]\displaystyle{ p }[/math] or [math]\displaystyle{ q }[/math] are not prime then the factoring algorithm can in turn be run on those until only primes remain.

A basic observation is that, using Euclid's algorithm, we can always compute the GCD between two integers efficiently. In particular, this means we can check efficiently whether [math]\displaystyle{ N }[/math] is even, in which case 2 is trivially a factor. Let us thus assume that [math]\displaystyle{ N }[/math] is odd for the remainder of this discussion. Afterwards, we can use efficient classical algorithms to check if [math]\displaystyle{ N }[/math] is a prime power.[19] For prime powers, efficient classical factorization algorithms exist,[20] hence the rest of the quantum algorithm may assume that [math]\displaystyle{ N }[/math] is not a prime power.

If those easy cases do not produce a nontrivial factor of [math]\displaystyle{ N }[/math], the algorithm proceeds to handle the remaining case. We pick a random integer [math]\displaystyle{ 2 \leq a \lt N }[/math]. A possible nontrivial divisor of [math]\displaystyle{ N }[/math] can be found by computing [math]\displaystyle{ \gcd(a, N) }[/math], which can be done classically and efficiently using the Euclidean algorithm. If this produces a nontrivial factor (meaning [math]\displaystyle{ \gcd(a, N) \ne 1 }[/math]), the algorithm is finished, and the other nontrivial factor is [math]\displaystyle{ \frac{N}{\gcd(a,N)} }[/math]. If a nontrivial factor was not identified, then that means that [math]\displaystyle{ N }[/math] and the choice of [math]\displaystyle{ a }[/math] are coprime. Here, the algorithm runs the quantum subroutine, which will return the order [math]\displaystyle{ r }[/math] of [math]\displaystyle{ a }[/math], meaning

[math]\displaystyle{ a^{r} \equiv 1 \bmod N. }[/math]

The quantum subroutine requires that [math]\displaystyle{ a }[/math] and [math]\displaystyle{ N }[/math] are coprime,[2] which is true since at this point in the algorithm, [math]\displaystyle{ \gcd(a, N) }[/math] did not produce a nontrivial factor of [math]\displaystyle{ N }[/math]. It can be seen from the congruence that [math]\displaystyle{ N }[/math] divides [math]\displaystyle{ a^{r} - 1 }[/math], written [math]\displaystyle{ N \mid a^{r} - 1 }[/math]. This can be factored using difference of squares:[math]\displaystyle{ N \mid (a^{r/2} - 1)(a^{r/2} + 1) }[/math] Since we have factored the expression in this way, the algorithm doesn't work for odd [math]\displaystyle{ r }[/math] (because [math]\displaystyle{ a^{r/2} }[/math] must be an integer), meaning the algorithm would have to restart with a new [math]\displaystyle{ a }[/math]. Hereafter we can therefore assume [math]\displaystyle{ r }[/math] is even. It cannot be the case that [math]\displaystyle{ N \mid a^{r/2} - 1 }[/math], since this would imply [math]\displaystyle{ a^{r/2} \equiv 1 \bmod N }[/math], which would contradictorily imply that [math]\displaystyle{ \frac{r}{2} }[/math] would be the order of [math]\displaystyle{ a }[/math], which was already [math]\displaystyle{ r }[/math]. At this point, it may or may not be the case that [math]\displaystyle{ N \mid a^{r/2} + 1 }[/math]. If it is not true that [math]\displaystyle{ N \mid a^{r/2} + 1 }[/math], then that means we are able to find a nontrivial factor of [math]\displaystyle{ N }[/math]. We compute[math]\displaystyle{ d = \gcd(N, a^{r/2} - 1) }[/math]If [math]\displaystyle{ d = 1 }[/math], then that means [math]\displaystyle{ N \mid a^{r/2} + 1 }[/math] was true, and a nontrivial factor of [math]\displaystyle{ N }[/math] cannot be achieved from [math]\displaystyle{ a }[/math], and the algorithm must restart with a new [math]\displaystyle{ a }[/math]. Otherwise, we have found a nontrivial factor of [math]\displaystyle{ N }[/math], with the other being [math]\displaystyle{ \frac{N}{d} }[/math], and the algorithm is finished. For this step, it is also equivalent to compute [math]\displaystyle{ \gcd(N, a^{r/2} + 1) }[/math]; it will produce a nontrivial factor if [math]\displaystyle{ \gcd(N, a^{r/2} - 1) }[/math] is nontrivial, and will not if it's trivial (where [math]\displaystyle{ N \mid a^{r/2} + 1 }[/math]).

The algorithm restated shortly follows: let [math]\displaystyle{ N }[/math] be odd, and not a prime power. We want to output two nontrivial factors of [math]\displaystyle{ N }[/math].

  1. Pick a random number [math]\displaystyle{ 1 \lt a \lt N }[/math].
  2. Compute [math]\displaystyle{ K=\gcd(a,N) }[/math], the greatest common divisor of [math]\displaystyle{ a }[/math] and [math]\displaystyle{ N }[/math].
  3. If [math]\displaystyle{ K \neq 1 }[/math], then [math]\displaystyle{ K }[/math] is a nontrivial factor of [math]\displaystyle{ N }[/math], with the other factor being [math]\displaystyle{ \frac{N}{K} }[/math] and we are done.
  4. Otherwise, use the quantum subroutine to find the order [math]\displaystyle{ r }[/math] of [math]\displaystyle{ a }[/math].
  5. If [math]\displaystyle{ r }[/math] is odd, then go back to step 1.
  6. Compute [math]\displaystyle{ g = \gcd(N, a^{r/2} + 1) }[/math]. If [math]\displaystyle{ g }[/math] is nontrivial, the other factor is [math]\displaystyle{ \frac{N}{g} }[/math], and we're done. Otherwise, go back to step 1.

It has been shown that this will be likely to succeed after a few runs.[2] In practice, a single call to the quantum order-finding subroutine is enough to completely factor [math]\displaystyle{ N }[/math] with very high probability of success if one uses a more advanced reduction.[21]

Quantum order-finding subroutine

The goal of the quantum subroutine of Shor's algorithm is, given coprime integers [math]\displaystyle{ N }[/math] and [math]\displaystyle{ 1\lt a\lt N }[/math], to find the order [math]\displaystyle{ r }[/math] of [math]\displaystyle{ a }[/math] modulo [math]\displaystyle{ N }[/math], which is the smallest positive integer such that [math]\displaystyle{ a^r \equiv 1 \pmod N }[/math]. To achieve this, Shor's algorithm uses a quantum circuit involving two registers. The second register uses [math]\displaystyle{ n }[/math] qubits, where [math]\displaystyle{ n }[/math] is the smallest integer such that [math]\displaystyle{ N\le 2^n }[/math]. The size of the first register determines how accurate of an approximation the circuit produces. It can be shown that using [math]\displaystyle{ 2n + 1 }[/math] qubits gives sufficient accuracy to find [math]\displaystyle{ r }[/math]. The exact quantum circuit depends on the parameters [math]\displaystyle{ a }[/math] and [math]\displaystyle{ N }[/math], which define the problem. The following description of the algorithm uses bra–ket notation to denote quantum states, and [math]\displaystyle{ \otimes }[/math] to denote the tensor product, rather than logical OR or logical XOR.

The algorithm consists of two main steps:

  1. Use quantum phase estimation with unitary [math]\displaystyle{ U }[/math] representing the operation of multiplying by [math]\displaystyle{ a }[/math] (modulo [math]\displaystyle{ N }[/math]), and input state [math]\displaystyle{ |0\rangle^{\otimes 2 n + 1}\otimes|1\rangle }[/math] (where the second register is [math]\displaystyle{ |1\rangle }[/math] made from [math]\displaystyle{ n }[/math] qubits). The eigenvalues of this [math]\displaystyle{ U }[/math] encode information about the period, and [math]\displaystyle{ |1\rangle }[/math] can be seen to be writable as a sum of its eigenvectors. Thanks to these properties, the quantum phase estimation stage gives as output a random integer of the form [math]\displaystyle{ \frac{j}{r} 2^{2n + 1} }[/math] for random [math]\displaystyle{ j=0,1,...,r-1 }[/math].
  2. Use the continued fractions algorithm to extract the period [math]\displaystyle{ r }[/math] from the measurement outcomes obtained in the previous stage. This is a procedure to post-process (with a classical computer) the measurement data obtained from measuring the output quantum states, and retrieve the period.

The connection with quantum phase estimation was not discussed in the original formulation of Shor's algorithm,[2] but was later proposed by Kitaev.[22]

Quantum phase estimation

Quantum subroutine in Shor's algorithm

In general the quantum phase estimation algorithm, for any unitary [math]\displaystyle{ U }[/math] and eigenstate [math]\displaystyle{ |\psi\rangle }[/math] such that [math]\displaystyle{ U|\psi\rangle=e^{2\pi i\theta} |\psi\rangle }[/math], sends inputs states [math]\displaystyle{ |0\rangle|\psi\rangle }[/math] into output states close to [math]\displaystyle{ |\phi\rangle|\psi\rangle }[/math], where [math]\displaystyle{ \phi }[/math] is an integer close to [math]\displaystyle{ 2^{2n + 1} \theta }[/math]. In other words, it sends each eigenstate [math]\displaystyle{ |\psi_j\rangle }[/math] of [math]\displaystyle{ U }[/math] into a state close to the associated eigenvalue. For the purposes of quantum order-finding, we employ this strategy using the unitary defined by the action[math]\displaystyle{ U|k\rangle = \begin{cases} |ak \pmod N\rangle & 0 \le k \lt N, \\ |k\rangle & N \le k \lt 2^n.\end{cases} }[/math]The action of [math]\displaystyle{ U }[/math] on states [math]\displaystyle{ |k\rangle }[/math] with [math]\displaystyle{ N \leq k \lt 2^n }[/math] is not crucial to the functioning of the algorithm, but needs to be included to ensure the overall transformation is a well-defined quantum gate. Implementing the circuit for quantum phase estimation with [math]\displaystyle{ U }[/math] requires being able to efficiently implement the gates [math]\displaystyle{ U^{2^j} }[/math]. This can be accomplished via modular exponentiation, which is the slowest part of the algorithm. The gate thus defined satisfies [math]\displaystyle{ U^r=I }[/math], which immediately implies that its eigenvalues are the [math]\displaystyle{ r }[/math]-th roots of unity [math]\displaystyle{ \omega_r^k=e^{2\pi ik/r} }[/math]. Furthermore, each eigenvalue [math]\displaystyle{ \omega_r^k }[/math] has an eigenvector of the form [math]\displaystyle{ |\psi_j\rangle=r^{-1/2}\sum_{k=0}^{r-1}\omega_r^{-kj}|a^k\rangle }[/math], and these eigenvectors are such that[math]\displaystyle{ \begin{align} \frac{1}{\sqrt{r}} \sum_{j = 0}^{r - 1} |\psi_j\rangle &= \frac{1}{r} \sum_{j = 0}^{r - 1} \sum_{k = 0}^{r - 1} \omega_r^{jk}|a^k\rangle \\ &= |1\rangle + \frac{1}{r} \sum_{k = 1}^{r - 1} \left(\sum_{j = 0}^{r - 1} \omega_r^{jk} \right) |a^k\rangle =|1\rangle, \end{align} }[/math]


where the last identity follows from the geometric series formula, which implies [math]\displaystyle{ \sum_{j = 0}^{r - 1} \omega_r^{jk} = 0 }[/math].

Using quantum phase estimation on an input state [math]\displaystyle{ |0\rangle^{\otimes 2 n + 1}|\psi_j\rangle }[/math] would then return the integer [math]\displaystyle{ 2^{2n + 1} j/r }[/math] with high probability. More precisely, the quantum phase estimation circuit sends [math]\displaystyle{ |0\rangle^{\otimes 2 n + 1}|\psi_j\rangle }[/math] to [math]\displaystyle{ |\phi_j\rangle|\psi_j\rangle }[/math] such that the resulting probability distribution [math]\displaystyle{ p_k \equiv|\langle k|\phi_j\rangle|^2 }[/math] is peaked around [math]\displaystyle{ k=2^{2n + 1} j/r }[/math], with [math]\displaystyle{ p_{2^{2n+1}j/r}\ge \frac{4}{\pi^2} \approx 0.4053 }[/math]. This probability can be made arbitrarily close to 1 using extra qubits.

Applying the above reasoning to the input [math]\displaystyle{ |0\rangle^{\otimes 2 n + 1}|1\rangle }[/math], quantum phase estimation thus results in the evolution[math]\displaystyle{ |0\rangle^{\otimes 2 n}|1\rangle = \frac{1}{\sqrt{r}} \sum_{j = 0}^{r - 1} |0\rangle^{\otimes 2 n} |\psi_j\rangle \to \frac{1}{\sqrt{r}} \sum_{j = 0}^{r - 1} |\phi_j\rangle|\psi_j\rangle. }[/math]Measuring the first register, we now have a balanced probability [math]\displaystyle{ 1/r }[/math] to find each [math]\displaystyle{ |\phi_j\rangle }[/math], each one giving an integer approximation to [math]\displaystyle{ 2^{2 n + 1} j/r }[/math], which can be divided by [math]\displaystyle{ 2^{2n + 1} }[/math] to get a decimal approximation for [math]\displaystyle{ j/r }[/math].

Continued fraction algorithm to retrieve the period

Then, we apply the continued fractions algorithm to find integers [math]\displaystyle{ b }[/math] and [math]\displaystyle{ c }[/math], where [math]\displaystyle{ \frac{b}{c} }[/math] gives the best fraction approximation for the approximation measured from the circuit, for [math]\displaystyle{ b, c \lt N }[/math] and coprime [math]\displaystyle{ b }[/math] and [math]\displaystyle{ c }[/math]. The number of qubits in the first register, [math]\displaystyle{ 2n + 1 }[/math], which determines the accuracy of the approximation, guarantees that[math]\displaystyle{ \frac{b}{c} = \frac{j}{r} }[/math]given the best approximation from the superposition of [math]\displaystyle{ |\phi_j\rangle }[/math] was measured[citation needed] (which can be made arbitrarily likely by using extra bits and truncating the output). However, while [math]\displaystyle{ b }[/math] and [math]\displaystyle{ c }[/math] are coprime, it may be the case that [math]\displaystyle{ j }[/math] and [math]\displaystyle{ r }[/math] are not coprime. Because of that, [math]\displaystyle{ b }[/math] and [math]\displaystyle{ c }[/math] may have lost some factors that were in [math]\displaystyle{ j }[/math] and [math]\displaystyle{ r }[/math]. This can be remedied by rerunning the quantum subroutine an arbitrary number of times, to produce a list of fraction approximations[math]\displaystyle{ \frac{b_1}{c_1}_{\textstyle ,} \; \frac{b_2}{c_2}_{\textstyle ,} \ldots \vphantom{\frac{b_1}{c_1}}_{\textstyle ,} \; \frac{b_s}{c_s} }[/math]where [math]\displaystyle{ s }[/math] is the number of times the algorithm was run. Each [math]\displaystyle{ c_k }[/math] will have different factors taken out of it because the circuit will (likely) have measured multiple different possible values of [math]\displaystyle{ j }[/math]. To recover the actual [math]\displaystyle{ r }[/math] value, we can take the least common multiple of each [math]\displaystyle{ c_k }[/math]:[math]\displaystyle{ \mathrm{lcm}(c_1, c_2, \ldots, c_s) }[/math]The least common multiple will be the order [math]\displaystyle{ r }[/math] of the original integer [math]\displaystyle{ a }[/math] with high probability.

Choosing the size of the first register

Phase estimation requires choosing the size of the first register to determine the accuracy of the algorithm, and for the quantum subroutine of Shor's algorithm, [math]\displaystyle{ 2n + 1 }[/math] qubits is sufficient to guarantee that the optimal bitstring measured from phase estimation (meaning the [math]\displaystyle{ |k\rangle }[/math] where [math]\displaystyle{ k / 2^{2n + 1} }[/math] is the most accurate approximation of the phase from phase estimation) will allow the actual value of [math]\displaystyle{ r }[/math] to be recovered.

Each [math]\displaystyle{ |\phi_j\rangle }[/math] before measurement in Shor's algorithm represents a superposition of integers approximating [math]\displaystyle{ 2^{2 n + 1} j/r }[/math]. Let [math]\displaystyle{ |k\rangle }[/math] represent the most optimal integer in [math]\displaystyle{ |\phi_j\rangle }[/math]. The following theorem guarantees that the continued fractions algorithm will recover [math]\displaystyle{ j/r }[/math] from [math]\displaystyle{ k/2^{2 {n} + 1} }[/math]:

Theorem — If [math]\displaystyle{ j }[/math] and [math]\displaystyle{ r }[/math] are [math]\displaystyle{ n }[/math] bit integers, and [math]\displaystyle{ \left\vert \frac{j}{r} - \phi\right\vert \leq \frac{1}{2 r^2} }[/math] then the continued fractions algorithm run on [math]\displaystyle{ \phi }[/math] will recover both [math]\displaystyle{ \frac{j}{\gcd(j,\; r)} }[/math] and [math]\displaystyle{ \frac{r}{\gcd(j,\; r)} }[/math].

[3] As [math]\displaystyle{ k }[/math] is the optimal bitstring from phase estimation, [math]\displaystyle{ k/2^{2 {n} + 1} }[/math] is accurate to [math]\displaystyle{ j/r }[/math] by [math]\displaystyle{ 2n + 1 }[/math] bits. Thus,[math]\displaystyle{ \left\vert\frac{j}{r} - \frac{k}{2^{2n + 1}}\right\vert \leq \frac{1}{2^{2 {n} + 1}} \leq \frac{1}{2N^2} \leq \frac{1}{2r^2} }[/math]which implys that the continued fractions algorithm will recover [math]\displaystyle{ j }[/math] and [math]\displaystyle{ r }[/math] (or with their greatest common divisor taken out).

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.[23][24] Reversible circuits typically use on the order of [math]\displaystyle{ n^3 }[/math] gates for [math]\displaystyle{ n }[/math] 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.

Period finding and discrete logarithms

Shor's algorithms for the discrete log and the order finding problems are instances of an algorithm solving the period finding problem.[citation needed]. All three are instances of the hidden subgroup problem.

Shor's algorithm for discrete logarithms

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

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

This gives us an abelian hidden subgroup problem, where [math]\displaystyle{ f }[/math] corresponds to a group homomorphism. The kernel corresponds to the multiples of [math]\displaystyle{ (r,1) }[/math]. So, if we can find the kernel, we can find [math]\displaystyle{ r }[/math]. A quantum algorithm for solving this problem exists. This algorithm is, like the factor-finding algorithm, due to Peter Shor and both are implemented by creating a superposition through using Hadamard gates, followed by implementing [math]\displaystyle{ f }[/math] as a quantum transform, followed finally by a quantum Fourier transform.[3] Due to this, the quantum algorithm for computing the discrete logarithm is also occasionally referred to as "Shor's Algorithm."

The order-finding problem can also be viewed as a hidden subgroup problem.[3] To see this, consider the group of integers under addition, and for a given [math]\displaystyle{ a\in\mathbb{Z} }[/math] such that: [math]\displaystyle{ a^{r}=1 }[/math], the function

[math]\displaystyle{ f \colon \mathbb{Z}\to \mathbb{Z} \;;\; f(x) = a^{x},\; f(x+r) = f(x) . }[/math]

For any finite abelian group [math]\displaystyle{ G }[/math], a quantum algorithm exists for solving the hidden subgroup for [math]\displaystyle{ G }[/math] in polynomial time.[3]

See also

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. pp. 124–134. doi:10.1109/sfcs.1994.365700. ISBN 0818665807. 
  2. 2.0 2.1 2.2 2.3 Shor, Peter W. (October 1997). "Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer". SIAM Journal on Computing 26 (5): 1484–1509. doi:10.1137/S0097539795293172. ISSN 0097-5397. 
  3. 3.0 3.1 3.2 3.3 3.4 Nielsen, Michael A.; Chuang, Isaac L. (9 December 2010). Quantum Computation and Quantum Information (7th ed.). Cambridge University Press. ISBN 978-1-107-00217-3. http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf. Retrieved 24 April 2022. 
  4. Gidney, Craig; Ekerå, Martin (2021). "How to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits". Quantum 5: 433. doi:10.22331/q-2021-04-15-433. Bibcode2021Quant...5..433G. 
  5. 5.0 5.1 cai, Jin-Yi (June 15, 2023). "Shor's Algorithm Does Not Factor Large Integers in the Presence of Noise". arXiv:2306.10072 [quant-ph].
  6. See also pseudo-polynomial time.
  7. Beckman, David; Chari, Amalavoyal N.; Devabhaktuni, Srikrishna; Preskill, John (1996). "Efficient Networks for Quantum Factoring". Physical Review A 54 (2): 1034–1063. doi:10.1103/PhysRevA.54.1034. PMID 9913575. Bibcode1996PhRvA..54.1034B. https://authors.library.caltech.edu/2179/1/BECpra96.pdf. 
  8. Harvey, David; van Der Hoeven, Joris (2020). "Integer multiplication in time O(n log n)". Annals of Mathematics. doi:10.4007/annals.2021.193.2.4. https://hal.archives-ouvertes.fr/hal-02070778. 
  9. "Number Field Sieve". wolfram.com. http://mathworld.wolfram.com/NumberFieldSieve.html. 
  10. Roetteler, Martin; Naehrig, Michael (2017). "Advances in Cryptology – ASIACRYPT 2017 – 23rd International Conference on the Theory and Applications of Cryptology and Information Security, Hong Kong, China, December 3–7, 2017, Proceedings, Part II". in Takagi, Tsuyoshi; Peyrin, Thomas. 10625. Springer. pp. 241–270. doi:10.1007/978-3-319-70697-9_9. 
  11. 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", Nature 414 (6866): 883–887, doi:10.1038/414883a, PMID 11780055, Bibcode2001Natur.414..883V, http://cryptome.org/shor-nature.pdf 
  12. 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", Physical Review Letters 99 (25): 250504, doi:10.1103/PhysRevLett.99.250504, PMID 18233508, Bibcode2007PhRvL..99y0504L, http://discovery.ucl.ac.uk/153160/1/153160.pdf 
  13. 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", Physical Review Letters 99 (25): 250505, doi:10.1103/PhysRevLett.99.250505, PMID 18233509, Bibcode2007PhRvL..99y0505L, http://espace.library.uq.edu.au/view/UQ:134503/UQ134503.pdf 
  14. Lucero, Erik; Barends, Rami; Chen, Yu; Kelly, Julian; Mariantoni, Matteo; Megrant, Anthony; O'Malley, Peter; Sank, Daniel et al. (2012). "Computing prime factors with a Josephson phase qubit quantum processor". Nature Physics 8 (10): 719. doi:10.1038/nphys2385. Bibcode2012NatPh...8..719L. 
  15. 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. doi:10.1038/nphoton.2012.259. Bibcode2012NaPho...6..773M. 
  16. 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. doi:10.1103/PhysRevA.100.012305. ISSN 2469-9926. 
  17. 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" (in en). npj Quantum Information 7 (1): 156. doi:10.1038/s41534-021-00478-z. ISSN 2056-6387. Bibcode2021npjQI...7..156K. https://www.nature.com/articles/s41534-021-00478-z. 
  18. "Quantum computing motte-and-baileys" (in en-US). 2019-12-28. https://scottaaronson.blog/?p=4447. 
  19. Bernstein, Daniel (1998). "Detecting perfect powers in essentially linear time" (in en). Mathematics of Computation 67 (223): 1253–1283. doi:10.1090/S0025-5718-98-00952-1. ISSN 0025-5718. https://www.ams.org/mcom/1998-67-223/S0025-5718-98-00952-1/. 
  20. e.g., computing the first [math]\displaystyle{ \log_2(N) }[/math] roots of [math]\displaystyle{ N }[/math], e.g., with the Newton method and checking each integer result for primality (AKS primality test).
  21. Ekerå, Martin (2021). "On completely factoring any integer efficiently in a single run of an order-finding algorithm". Quantum Information Processing 20 (6): 1–14. doi:10.1007/s11128-021-03069-1. ISSN 1570-0755. Bibcode2021QuIP...20..205E. 
  22. Kitaev, A. Yu (1995-11-20). "Quantum measurements and the Abelian Stabilizer Problem". arXiv:quant-ph/9511026.
  23. Markov, Igor L.; Saeedi, Mehdi (2012). "Constant-Optimized Quantum Circuits for Modular Multiplication and Exponentiation". Quantum Information and Computation 12 (5–6): 361–394. doi:10.26421/QIC12.5-6-1. Bibcode2012arXiv1202.6614M. 
  24. Markov, Igor L.; Saeedi, Mehdi (2013). "Faster Quantum Number Factoring via Circuit Synthesis". Phys. Rev. A 87 (1): 012310. doi:10.1103/PhysRevA.87.012310. Bibcode2013PhRvA..87a2310M. 
  25. Bernstein, Daniel J.; Heninger, Nadia; Lou, Paul; Valenta, Luke (2017). "Post-quantum RSA". Post-Quantum Cryptography. Lecture Notes in Computer Science. 10346. pp. 311–329. doi:10.1007/978-3-319-59879-6_18. ISBN 978-3-319-59878-9. https://cr.yp.to/papers/pqrsa-20170419.pdf. 

Further reading

External links