fbpx
Wikipedia

Shor's algorithm

Shor's algorithm is a quantum computer algorithm for finding the prime factors of an integer. It was developed in 1994 by the American mathematician Peter Shor.[1]

On a quantum computer, to factor an integer , Shor's algorithm runs in polylogarithmic time, meaning the time taken is polynomial in , the size of the integer given as input.[2] Specifically, it takes quantum gates of order using fast multiplication,[3] or even utilizing the asymptotically fastest multiplication algorithm currently known due to Harvey and Van Der Hoven,[4] 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: .[5] The efficiency of Shor's algorithm is due to the efficiency of the quantum Fourier transform, and modular exponentiation by repeated squarings.[6]

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

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 into , using an NMR implementation of a quantum computer with qubits.[8] 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.[9][10] In 2012, the factorization of was performed with solid-state qubits.[11] Later, in 2012, the factorization of was achieved.[12] In 2019 an attempt was made to factor the number using Shor's algorithm on an IBM Q System One, but the algorithm failed because of accumulating errors.[13] Though larger numbers have been factored by quantum computers using other algorithms,[14] 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.[15]

Procedure

The problem that we are trying to solve is, given a composite number  , to find a non-trivial divisor of   (a divisor strictly between   and  ). Before attempting to find such a divisor, if there's any doubt whether   is composite or prime, one can use relatively quick primality-testing algorithms to verify that   is indeed composite, although this is not a part of Shor's algorithm.

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.

The aim of the algorithm is to find a non-trivial square root   of   modulo   that is different from   and  , because then

 

for a non-zero integer   that gives us two distinct non-trivial divisors   and   of  . This idea is similar to other factoring algorithms, such as the quadratic sieve, and a more detailed explanation can be found in the Explanation section below. Before starting the algorithm, it is imperative to check   to be odd (otherwise   is a divisor) and not to be any power of an integer (otherwise that integer is a divisor), so as to guarantee the existence of a non-trivial square root   of   modulo  .

In turn, finding such a   is reduced to finding an element   as a parameter in an integer function, such that the function has an 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  , as this is a difficult problem on a classical computer.

Classical part

  1. Pick a random number  .
  2. Compute  , the greatest common divisor of   and  . This may be done using the Euclidean algorithm.
  3. If  , then   is a nontrivial factor of  , so we are done.
  4. Otherwise, use the quantum period-finding subroutine (below) to find  , which denotes the period of the following function:
     
    Equivalently,   is the smallest positive integer that satisfies  ).
  5. If   is odd, then go back to step 1.
  6. If  , then go back to step 1.
  7. Otherwise, both   or   are nontrivial factors of  , so we are done.

For example: Given  ,  , and  , i.e.,  we have  , where   and  . For   that is a product of two distinct primes,   and  ,  , which for   is  , and   divides  .

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   and each choice of the random   which have the relationship  . Given value  , a value   is chosen such that  . Such a value of   implies that  . The input and output qubit registers will store superpositions of values from   to  . Therefore, these registers have   qubits each. Using what might appear to be twice as many qubits as necessary guarantees that there are at least   different values of   that produce the same  , even as the period   approaches  . The following uses bra-ket notation to denote quantum states.

Proceed as follows:

  1. Initialize the registers to
     

    where   denotes the tensor product.

    This initial state is a superposition of   states, and is obtained by generating   independent qubits, each an equal superposition of   and   states. We can accomplish this by initializing the qubits to the zero-position, and then applying a Hadamard gate to each of the   qubits, where  . This process is called the Hadamard transform.
  2. Construct   as a quantum function and apply it to the above state, to obtain
     
     
    Note:  . This is still a superposition of   states. However, the   qubits, i.e, the   input qubits and   ( ) 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   we are looking for is now stored in the phase of the input qubits   as a result of "phase kickback", where using qubits as control inputs to unitary gates alters the relative phase of the control qubits.[16]
  3. Apply the inverse quantum Fourier transform to the input register. This transform (operating on a superposition of   states) uses a  -th root of unity such as   to distribute the amplitude of any given   state equally among all   of the   states, and to do so in a different way for each different  . We thus obtain
     
    This leads to the final state
     
    Now, we reorder this sum as
     
    This is a superposition of many more than   states, but many fewer than   states, as there are fewer than   distinct values of  . Let
    •   be a  -th root of unity,
    •   be the period of  ,
    •   be the smallest of the   for which   (we have  ), and
    • write  
    •   indexes these  , running from   to  , so that  .
    Then   is a unit vector in the complex plane (  is a root of unity, and   and   are integers), and the coefficient of   in the final state is
     
    Each term in this sum represents a different path to the same result, and quantum interference occurs — constructive when the unit vectors   point in nearly the same direction in the complex plane, which requires that   point along the positive real axis.
  4. Perform a measurement. We obtain some outcome   in the input register and some outcome   in the output register. As   is periodic, the probability of measuring some state   is given by
     
     
    Analysis now shows that this probability is higher the closer the unit vector   is to the positive real axis, or the closer   is to an integer. Unless   is a power of  , it will not be a factor of  .
  5. Since   is close to some integer  , the known value   is close to the unknown value  . Performing [classical] continued fraction expansion on   allows us to find approximations   of it that satisfy two conditions:
    1.  .
    2.  .
    Given these multiple conditions (and assuming   is irreducible),   is very likely to be the appropriate period  , or at least a factor of it.
  6. Check (classically) if  . If so, then we are done.
  7. Otherwise, (classically) obtain more candidates for   by using multiples of  , or by using other   with   near  . 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.

Non-trivial square root of [1 modulo N]

Shor's algorithm hinges on finding a non-trivial square root of   modulo  ; That is, a solution to

 

where  .

If such   exists, we claim that   is a proper factor of  , i.e.,  . In fact, if

 , then   divides  , so that  , which goes against the construction of  . If, on the other hand,  , then by Bézout's identity, there are integers   such that

 

Multiplying both sides by  , we obtain

 

As   divides  , we find that   divides  , so that  , again contradicting the construction of  .

Therefore,   is the required proper factor of  . Similarly, it can be proven that   is also a proper factor of  .

For such a non-trivial square root of   modulo   to exist, notice that  , and for any power of an odd prime  , there is no non-trivial square root of   modulo  : For any   either   or   has to be a multiple of  .

Therefore, for Shor's algorithm to work, we need   to be odd (otherwise   is a divisor) and not to be any power of an odd prime (otherwise that prime is a divisor). We can check that there are no integer roots   for  , and if   is not a power of any integer, it is not a power of any odd prime. Here, the upper bound for the integer   that we need to check is determined by  , since for   to be odd,   cannot be  . This check, however, cannot rule out that   may be an odd prime itself, which can only be ruled out by primality-testing algorithms.

Given that   is odd and not any power of an odd prime, based on the fundamental theorem of arithmetic, we may assume that   is the product of two coprime integers greater than   (  and  ). From the four combinations of choosing plus sign and minus sign in the integer equations  , based on the Chinese remainder theorem and  , there are at least four distinct square roots of   modulo  , and therefore at least two distinct non-trivial square roots exist. In fact, they are the solutions to   and  .

Obtaining factors from period

The integers less than   and coprime with   form the multiplicative group of integers modulo  , which is a finite abelian group  . The size of this group is given by  . By the end of step 3, we have an integer   in this group. As the group is finite,   must have a finite order  , which is the smallest positive integer such that

 

This is the order   of the finite cyclic subgroupa⟩ of the group  , which is the smallest positive integer   for which  . Since   and   are coprime, by Euler's totient theorem,   must exist, and divides  , where   denotes Euler's totient function.

Therefore,   divides   (also written  ). Suppose that we are able to obtain   and that it is even. (If   is odd, then by step 5, we have to restart the algorithm with a different random number  ) Now   is a square root of   modulo   that is different from  . This is because   is the order of   modulo  , so  , or else the order of   in this group would be  . If  , then by step 6, we have to restart the algorithm with a different random number  .

Eventually, we must hit an   of order   in   such that  . This is because such a   is a square root of   modulo   other than   and  , whose existence is guaranteed by the Chinese remainder theorem, as the odd number   is not a prime power.

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  , 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   without measuring  , and then make a few copies of the resulting state (which is a superposition of states all having the same  ). Measuring   on these states would provide different   values which give the same  , 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  .

  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   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  ) that uses just   gates.[17]

After all these transformations, a measurement will yield an approximation to the period  . For simplicity assume that there is a   such that   is an integer. Then the probability to measure   is  . To see this, we notice that then

 

for all integers  . Therefore, the sum whose square gives us the probability to measure   will be  , as   takes roughly   values and thus the probability is  . There are   possible values of   such that   is an integer, and also   possibilities for  , so the probabilities sum to  .

The period-finding routine can be considered a variation of the more general quantum phase estimation algorithm to determine the eigenvalue of a unitary corresponding to an eigenvector. In the case of the period-finding routine used in Shor's Algorithm, the unitary in question is modular multiplication by the chosen base mod  . While the computational basis   is not an eigenvector of this unitary, it is a uniform superposition of its   eigenvectors and thus the measurement will give the eigenvalue's phase for one of the eigenvectors. Since not all such phases can be used to extract the period, the retries of the subroutine may be necessary.[18]

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.[19][20] Reversible circuits typically use on the order of   gates for   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   with order   and generator  , suppose we know that  , for some  , and we wish to compute  , which is the discrete logarithm:  . Consider the abelian group  , where each factor corresponds to modular addition of values. Now, consider the function

 

This gives us an abelian hidden subgroup problem, as   corresponds to a group homomorphism. The kernel corresponds to the multiples of  . So, if we can find the kernel, we can find  . 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   as a quantum transform, followed finally by a quantum Fourier transform.[18] 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.[18] To see this, consider the group of integers under addition, and for a given   such that:  , the function

 

For any finite abelian group G, a quantum algorithm exists for solving the hidden subgroup for G in polynomial time.[18]

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: 124–134. doi:10.1109/sfcs.1994.365700. ISBN 0818665807. S2CID 15291489.
  2. ^ See also pseudo-polynomial time.
  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. ^ 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. S2CID 109934776.
  5. ^ "Number Field Sieve". wolfram.com. Retrieved 23 October 2015.
  6. ^ Gidney, Craig. "Shor's Quantum Factoring Algorithm". Algorithmic Assertions. Retrieved 28 November 2020.
  7. ^ Roetteler, Martin; Naehrig, Michael; Svore, Krysta M.; Lauter, Kristin E. (2017). "Quantum resource estimates for computing elliptic curve discrete logarithms". In Takagi, Tsuyoshi; Peyrin, Thomas (eds.). 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. Lecture Notes in Computer Science. Vol. 10625. Springer. pp. 241–270. arXiv:1706.06752. doi:10.1007/978-3-319-70697-9_9.
  8. ^ 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
  9. ^ 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
  10. ^ 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
  11. ^ 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.
  12. ^ 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.
  13. ^ 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.
  14. ^ 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): 156. arXiv:2012.07825. Bibcode:2021npjQI...7..156K. doi:10.1038/s41534-021-00478-z. ISSN 2056-6387. S2CID 229156747.
  15. ^ "Quantum computing motte-and-baileys". Shtetl-Optimized. 2019-12-28. Retrieved 2021-11-15.
  16. ^ Qiskit authors. "Qiskit Textbook: Quantum Phase Estimation". IBM. Retrieved 7 November 2020.
  17. ^ Shor 1999, p. 14
  18. ^ a b c d Nielsen, Michael A.; Chuang, Isaac L. (9 December 2010). Quantum Computation and Quantum Information (PDF) (7th ed.). Cambridge University Press. ISBN 978-1-107-00217-3. (PDF) from the original on 2019-07-11. Retrieved 24 April 2022.
  19. ^ 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.
  20. ^ 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.
  21. ^ 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. (PDF) from the original on 2017-04-20.

Further reading

  • 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.
  • , 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

External links

  • Version 1.0.0 of libquantum: contains a C language implementation of Shor's algorithm with their simulated quantum computer library, but the width variable in shor.c should be set to 1 to improve the runtime complexity.
  • PBS Infinite Series created two videos explaining the math behind Shor's algorithm, "How to Break Cryptography" and "Hacking at Quantum Speed with Shor's Algorithm".

shor, algorithm, this, article, includes, list, general, references, lacks, sufficient, corresponding, inline, citations, please, help, improve, this, article, introducing, more, precise, citations, september, 2010, learn, when, remove, this, template, message. This article includes a list of general references but it lacks sufficient corresponding inline citations Please help to improve this article by introducing more precise citations September 2010 Learn how and when to remove this template message Shor s algorithm is a quantum computer algorithm for finding the prime factors of an integer It was developed in 1994 by the American mathematician Peter Shor 1 On a quantum computer to factor an integer N displaystyle N Shor s algorithm runs in polylogarithmic time meaning the time taken is polynomial in log N displaystyle log N the size of the integer given as input 2 Specifically it takes quantum gates of order O log N 2 log log N log log log N displaystyle O left log N 2 log log N log log log N right using fast multiplication 3 or even O log N 2 log log N displaystyle O left log N 2 log log N right utilizing the asymptotically fastest multiplication algorithm currently known due to Harvey and Van Der Hoven 4 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 O e 1 9 log N 1 3 log log N 2 3 displaystyle O left e 1 9 log N 1 3 log log N 2 3 right 5 The efficiency of Shor s algorithm is due to the efficiency of the quantum Fourier transform and modular exponentiation by repeated squarings 6 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 7 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 15 displaystyle 15 into 3 5 displaystyle 3 times 5 using an NMR implementation of a quantum computer with 7 displaystyle 7 qubits 8 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 9 10 In 2012 the factorization of 15 displaystyle 15 was performed with solid state qubits 11 Later in 2012 the factorization of 21 displaystyle 21 was achieved 12 In 2019 an attempt was made to factor the number 35 displaystyle 35 using Shor s algorithm on an IBM Q System One but the algorithm failed because of accumulating errors 13 Though larger numbers have been factored by quantum computers using other algorithms 14 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 15 Contents 1 Procedure 1 1 Classical part 1 2 Quantum part period finding subroutine 2 Explanation of the algorithm 2 1 Non trivial square root of 1 modulo N 2 2 Obtaining factors from period 2 3 Finding the period 2 4 The bottleneck 3 Discrete logarithms 4 See also 5 References 6 Further reading 7 External linksProcedure EditThe problem that we are trying to solve is given a composite number N displaystyle N to find a non trivial divisor of N displaystyle N a divisor strictly between 1 displaystyle 1 and N displaystyle N Before attempting to find such a divisor if there s any doubt whether N displaystyle N is composite or prime one can use relatively quick primality testing algorithms to verify that N displaystyle N is indeed composite although this is not a part of Shor s algorithm Shor s algorithm consists of two parts A reduction which can be done on a classical computer of the factoring problem to the problem of order finding A quantum algorithm to solve the order finding problem The aim of the algorithm is to find a non trivial square root b displaystyle b of 1 displaystyle 1 modulo N displaystyle N that is different from 1 displaystyle 1 and 1 displaystyle 1 because then b 2 1 b 1 b 1 m N displaystyle b 2 1 b 1 b 1 mN for a non zero integer m displaystyle m that gives us two distinct non trivial divisors gcd N b 1 displaystyle gcd N b 1 and gcd N b 1 displaystyle gcd N b 1 of N displaystyle N This idea is similar to other factoring algorithms such as the quadratic sieve and a more detailed explanation can be found in the Explanation section below Before starting the algorithm it is imperative to check N displaystyle N to be odd otherwise 2 displaystyle 2 is a divisor and not to be any power of an integer otherwise that integer is a divisor so as to guarantee the existence of a non trivial square root b displaystyle b of 1 displaystyle 1 modulo N displaystyle N In turn finding such a b displaystyle b is reduced to finding an element a displaystyle a as a parameter in an integer function such that the function has an 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 a displaystyle a as this is a difficult problem on a classical computer Classical part Edit Pick a random number 1 lt a lt N displaystyle 1 lt a lt N Compute K gcd a N displaystyle K gcd a N the greatest common divisor of a displaystyle a and N displaystyle N This may be done using the Euclidean algorithm If K 1 displaystyle K neq 1 then K displaystyle K is a nontrivial factor of N displaystyle N so we are done Otherwise use the quantum period finding subroutine below to find r displaystyle r which denotes the period of the following function f x a x mod N displaystyle f x a x bmod N Equivalently r displaystyle r is the smallest positive integer that satisfies a r 1 mod N displaystyle a r equiv 1 bmod N If r displaystyle r is odd then go back to step 1 If a r 2 1 mod N displaystyle a r 2 1 bmod N then go back to step 1 Otherwise both gcd a r 2 1 N displaystyle gcd a r 2 1 N or gcd a r 2 1 N displaystyle gcd a r 2 1 N are nontrivial factors of N displaystyle N so we are done For example Given N 15 displaystyle N 15 a 7 displaystyle a 7 and r 4 displaystyle r 4 i e mod 1 15 mod 7 4 15 mod 7 8 15 displaystyle bmod 1 15 bmod 7 4 15 bmod 7 8 15 we have gcd 7 2 1 15 gcd 49 1 15 displaystyle gcd 7 2 pm 1 15 gcd 49 pm 1 15 where gcd 48 15 3 displaystyle gcd 48 15 3 and gcd 50 15 5 displaystyle gcd 50 15 5 For N displaystyle N that is a product of two distinct primes p displaystyle p and q displaystyle q f N p 1 q 1 displaystyle varphi N p 1 q 1 which for N 15 displaystyle N 15 is 8 displaystyle 8 and r displaystyle r divides 8 displaystyle 8 Quantum part period finding subroutine Edit This section may be too technical for most readers to understand Please help improve it to make it understandable to non experts without removing the technical details February 2014 Learn how and when to remove this template message Quantum subroutine in Shor s algorithm The quantum circuits used for this algorithm are custom designed for each choice of N displaystyle N and each choice of the random a displaystyle a which have the relationship f x a x mod N displaystyle f x a x bmod N Given value N displaystyle N a value Q 2 q displaystyle Q 2 q is chosen such that N 2 Q lt 2 N 2 displaystyle N 2 leq Q lt 2N 2 Such a value of Q displaystyle Q implies that Q r gt N displaystyle dfrac Q r gt N The input and output qubit registers will store superpositions of values from 0 displaystyle 0 to Q 1 displaystyle Q 1 Therefore these registers have q displaystyle q qubits each Using what might appear to be twice as many qubits as necessary guarantees that there are at least N displaystyle N different values of x displaystyle x that produce the same f x displaystyle f x even as the period r displaystyle r approaches N 2 displaystyle dfrac N 2 The following uses bra ket notation to denote quantum states Proceed as follows Initialize the registers to 1 Q x 0 Q 1 x 1 2 x 1 0 1 x 1 1 2 x q 0 1 x q 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 Q displaystyle Q states and is obtained by generating q displaystyle q independent qubits each an equal superposition of 0 displaystyle 0 and 1 displaystyle 1 states We can accomplish this by initializing the qubits to the zero position and then applying a Hadamard gate to each of the q displaystyle q qubits where 2 q Q displaystyle 2 q Q This process is called the Hadamard transform Construct f x displaystyle f x as a quantum function and apply it to the above state to obtain U f x 0 n x f x displaystyle U f x 0 n rangle x f x rangle U f 1 Q x 0 Q 1 x 0 n 1 Q x 0 Q 1 x f x displaystyle U f frac 1 sqrt Q sum x 0 Q 1 x 0 n rangle frac 1 sqrt Q sum x 0 Q 1 x f x rangle Note f x a x mod N displaystyle f x a x bmod N This is still a superposition of Q displaystyle Q states However the q n displaystyle q n qubits i e the q displaystyle q input qubits and n displaystyle n gt log 2 N displaystyle gt 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 r displaystyle r we are looking for is now stored in the phase of the input qubits x 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 16 Apply the inverse quantum Fourier transform to the input register This transform operating on a superposition of Q 2 q displaystyle Q 2 q states uses a Q displaystyle Q th root of unity such as w e 2 p i Q displaystyle omega e frac 2 pi i Q to distribute the amplitude of any given x displaystyle x rangle state equally among all Q displaystyle Q of the y displaystyle y rangle states and to do so in a different way for each different x displaystyle x We thus obtain U QFT x 1 Q y 0 Q 1 w x y y 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 1 Q x 0 Q 1 y 0 Q 1 w x y y f x 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 1 Q z 0 N 1 y 0 Q 1 x 0 Q 1 f x z w x y y z 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 Q displaystyle Q states but many fewer than Q 2 displaystyle Q 2 states as there are fewer than Q displaystyle Q distinct values of z f x displaystyle z f x Let w e 2 p i Q displaystyle omega e frac 2 pi i Q be a Q displaystyle Q th root of unity r displaystyle r be the period of f displaystyle f x 0 displaystyle x 0 be the smallest of the x 0 Q 1 displaystyle x in 0 ldots Q 1 for which f x z displaystyle f x z we have x 0 lt r displaystyle x 0 lt r and write m 1 Q x 0 1 r displaystyle m 1 left lfloor frac Q x 0 1 r right rfloor b displaystyle b indexes these x displaystyle x running from 0 displaystyle 0 to m 1 displaystyle m 1 so that x 0 r b lt Q displaystyle x 0 rb lt Q Then w r y displaystyle omega ry is a unit vector in the complex plane w displaystyle omega is a root of unity and r displaystyle r and y displaystyle y are integers and the coefficient of 1 Q y z displaystyle dfrac 1 Q left y z right rangle in the final state is x 0 Q 1 f x z w x y b 0 m 1 w x 0 r b y w x 0 y b 0 m 1 w r b y 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 w r y b displaystyle omega ryb point in nearly the same direction in the complex plane which requires that w r y displaystyle omega ry point along the positive real axis Perform a measurement We obtain some outcome y displaystyle y in the input register and some outcome z displaystyle z in the output register As f displaystyle f is periodic the probability of measuring some state y z displaystyle y z rangle is given by P r y z 1 Q x 0 Q 1 f x z w x y 2 1 Q 2 b 0 m 1 w x 0 r b y 2 1 Q 2 w x 0 y 2 b 0 m 1 w b r y 2 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 1 Q 2 b 0 m 1 w b r y 2 1 Q 2 w m r y 1 w r y 1 2 1 Q 2 sin 2 p m r y Q sin 2 p r y Q 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 w r y displaystyle omega ry is to the positive real axis or the closer y r Q displaystyle dfrac yr Q is to an integer Unless r displaystyle r is a power of 2 displaystyle 2 it will not be a factor of Q displaystyle Q Since y r Q displaystyle frac yr Q is close to some integer c displaystyle c the known value y Q displaystyle dfrac y Q is close to the unknown value c r displaystyle dfrac c r Performing classical continued fraction expansion on y Q displaystyle dfrac y Q allows us to find approximations d s displaystyle dfrac d s of it that satisfy two conditions s lt N displaystyle s lt N y Q d s lt 1 2 Q displaystyle left dfrac y Q dfrac d s right lt dfrac 1 2Q Given these multiple conditions and assuming d s displaystyle dfrac d s is irreducible s displaystyle s is very likely to be the appropriate period r displaystyle r or at least a factor of it Check classically if f x f x s a s 1 mod N displaystyle f x f x s Leftrightarrow a s equiv 1 bmod N If so then we are done Otherwise classically obtain more candidates for r displaystyle r by using multiples of s displaystyle s or by using other s displaystyle s with d s displaystyle dfrac d s near y Q displaystyle dfrac y Q If any candidate works then we are done Otherwise try again starting from step 1 of this subroutine Explanation of the algorithm EditThe 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 Non trivial square root of 1 modulo N Edit Shor s algorithm hinges on finding a non trivial square root of 1 displaystyle 1 modulo N displaystyle N That is a solution to b 2 1 mod N displaystyle b 2 equiv 1 bmod N where b 1 mod N displaystyle b not equiv pm 1 bmod N If such b displaystyle b exists we claim that d gcd b 1 N displaystyle d gcd b 1 N is a proper factor of N displaystyle N i e d 1 N displaystyle d neq 1 N In fact ifd N displaystyle d N then N displaystyle N divides b 1 displaystyle b 1 so that b 1 mod N displaystyle b equiv 1 bmod N which goes against the construction of b displaystyle b If on the other hand d gcd b 1 N 1 displaystyle d gcd b 1 N 1 then by Bezout s identity there are integers u v displaystyle u v such that b 1 u N v 1 displaystyle b 1 u Nv 1 Multiplying both sides by b 1 displaystyle b 1 we obtain b 2 1 u N b 1 v b 1 displaystyle b 2 1 u N b 1 v b 1 As N displaystyle N divides b 2 1 displaystyle b 2 1 we find that N displaystyle N divides b 1 displaystyle b 1 so that b 1 mod N displaystyle b equiv 1 bmod N again contradicting the construction of b displaystyle b Therefore d displaystyle d is the required proper factor of N displaystyle N Similarly it can be proven that gcd b 1 N displaystyle gcd b 1 N is also a proper factor of N displaystyle N For such a non trivial square root of 1 displaystyle 1 modulo N displaystyle N to exist notice that 1 1 mod 2 displaystyle 1 equiv 1 bmod 2 and for any power of an odd prime N p n displaystyle N p n there is no non trivial square root of 1 displaystyle 1 modulo N displaystyle N For any b 1 b 1 m p n displaystyle b 1 b 1 mp n either b 1 displaystyle b 1 or b 1 displaystyle b 1 has to be a multiple of N p n displaystyle N p n Therefore for Shor s algorithm to work we need N displaystyle N to be odd otherwise 2 displaystyle 2 is a divisor and not to be any power of an odd prime otherwise that prime is a divisor We can check that there are no integer roots N k displaystyle sqrt k N for 2 k log 3 N displaystyle 2 leq k leq log 3 N and if N displaystyle N is not a power of any integer it is not a power of any odd prime Here the upper bound for the integer k displaystyle k that we need to check is determined by N k 3 displaystyle sqrt k N geq 3 since for N displaystyle N to be odd N k displaystyle sqrt k N cannot be 2 displaystyle 2 This check however cannot rule out that N displaystyle N may be an odd prime itself which can only be ruled out by primality testing algorithms Given that N displaystyle N is odd and not any power of an odd prime based on the fundamental theorem of arithmetic we may assume that N displaystyle N is the product of two coprime integers greater than 2 displaystyle 2 N n 1 n 2 displaystyle N n 1 n 2 and n 1 n 2 gt 2 gcd n 1 n 2 1 displaystyle n 1 n 2 gt 2 gcd n 1 n 2 1 From the four combinations of choosing plus sign and minus sign in the integer equations x m 1 n 1 1 m 2 n 2 1 displaystyle x m 1 n 1 pm 1 m 2 n 2 pm 1 based on the Chinese remainder theorem and n 1 n 2 gt 2 displaystyle n 1 n 2 gt 2 there are at least four distinct square roots of 1 displaystyle 1 modulo N displaystyle N and therefore at least two distinct non trivial square roots exist In fact they are the solutions to b m 1 n 1 1 m 2 n 2 1 displaystyle b m 1 n 1 1 m 2 n 2 1 and b m 1 n 1 1 m 2 n 2 1 displaystyle b m 1 n 1 1 m 2 n 2 1 Obtaining factors from period Edit The integers less than N displaystyle N and coprime with N displaystyle N form the multiplicative group of integers modulo N displaystyle N which is a finite abelian group G displaystyle G The size of this group is given by f N displaystyle varphi N By the end of step 3 we have an integer a displaystyle a in this group As the group is finite a displaystyle a must have a finite order r displaystyle r which is the smallest positive integer such that a r 1 mod N displaystyle a r equiv 1 bmod N This is the order r displaystyle r of the finite cyclic subgroup a of the group Z N displaystyle mathbb Z N times which is the smallest positive integer r displaystyle r for which a x r mod N a x mod N displaystyle a x r bmod N equiv a x bmod N Since a displaystyle a and N displaystyle N are coprime by Euler s totient theorem r displaystyle r must exist and divides f N displaystyle varphi N where f displaystyle varphi denotes Euler s totient function Therefore N displaystyle N divides a r 1 displaystyle a r 1 also written N a r 1 displaystyle N mid a r 1 Suppose that we are able to obtain r displaystyle r and that it is even If r displaystyle r is odd then by step 5 we have to restart the algorithm with a different random number a displaystyle a Now b a r 2 mod N displaystyle b equiv a r 2 bmod N is a square root of 1 displaystyle 1 modulo N displaystyle N that is different from 1 displaystyle 1 This is because r displaystyle r is the order of a displaystyle a modulo N displaystyle N so a r 2 1 mod N displaystyle a r 2 not equiv 1 bmod N or else the order of a displaystyle a in this group would be r 2 displaystyle dfrac r 2 If a r 2 1 mod N displaystyle a r 2 equiv 1 bmod N then by step 6 we have to restart the algorithm with a different random number a displaystyle a Eventually we must hit an a displaystyle a of order r displaystyle r in G displaystyle G such that b a r 2 1 mod N displaystyle b equiv a r 2 not equiv pm 1 bmod N This is because such a b displaystyle b is a square root of 1 displaystyle 1 modulo N displaystyle N other than 1 displaystyle 1 and 1 displaystyle 1 whose existence is guaranteed by the Chinese remainder theorem as the odd number N displaystyle N is not a prime power Finding the period Edit 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 f 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 f x displaystyle f x without measuring x displaystyle x and then make a few copies of the resulting state which is a superposition of states all having the same f x displaystyle f x Measuring x displaystyle x on these states would provide different x displaystyle x values which give the same f x 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 log N displaystyle log N 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 Implement the function f 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 Perform a quantum Fourier transform By using controlled rotation gates and Hadamard gates Shor designed a circuit for the quantum Fourier transform with Q 2 q displaystyle Q 2 q that uses just q q 1 2 O log Q 2 displaystyle dfrac q q 1 2 O left log Q 2 right gates 17 After all these transformations a measurement will yield an approximation to the period r displaystyle r For simplicity assume that there is a y displaystyle y such that y r Q displaystyle dfrac yr Q is an integer Then the probability to measure y displaystyle y is 1 displaystyle 1 To see this we notice that then e 2 p i b y r Q 1 displaystyle e frac 2 pi ibyr Q 1 for all integers b displaystyle b Therefore the sum whose square gives us the probability to measure y displaystyle y will be Q r displaystyle dfrac Q r as b displaystyle b takes roughly Q r displaystyle dfrac Q r values and thus the probability is 1 r 2 displaystyle dfrac 1 r 2 There are r displaystyle r possible values of y displaystyle y such that y r Q displaystyle dfrac yr Q is an integer and also r displaystyle r possibilities for f x 0 displaystyle f x 0 so the probabilities sum to 1 displaystyle 1 The period finding routine can be considered a variation of the more general quantum phase estimation algorithm to determine the eigenvalue of a unitary corresponding to an eigenvector In the case of the period finding routine used in Shor s Algorithm the unitary in question is modular multiplication by the chosen base mod N displaystyle N While the computational basis 1 displaystyle 1 rangle is not an eigenvector of this unitary it is a uniform superposition of its r displaystyle r eigenvectors and thus the measurement will give the eigenvalue s phase for one of the eigenvectors Since not all such phases can be used to extract the period the retries of the subroutine may be necessary 18 The bottleneck Edit 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 19 20 Reversible circuits typically use on the order of n 3 displaystyle n 3 gates for n 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 EditGiven a group G displaystyle G with order p displaystyle p and generator g G displaystyle g in G suppose we know that x g r G displaystyle x g r in G for some r Z p displaystyle r in mathbb Z p and we wish to compute r displaystyle r which is the discrete logarithm r log g x displaystyle r log g x Consider the abelian group Z p Z p displaystyle mathbb Z p times mathbb Z p where each factor corresponds to modular addition of values Now consider the function f Z p Z p G f a b g a x b 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 f displaystyle f corresponds to a group homomorphism The kernel corresponds to the multiples of r 1 displaystyle r 1 So if we can find the kernel we can find r displaystyle r 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 f displaystyle f as a quantum transform followed finally by a quantum Fourier transform 18 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 18 To see this consider the group of integers under addition and for a given a Z displaystyle a in mathbb Z such that a r 1 displaystyle a r 1 the function f Z Z f x a x f x r f x displaystyle f colon mathbb Z to mathbb Z f x a x f x r f x For any finite abelian group G a quantum algorithm exists for solving the hidden subgroup for G in polynomial time 18 See also EditGEECM a factorization algorithm said to be often much faster than Shor s 21 Grover s algorithmReferences Edit 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 See also pseudo polynomial time 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 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 S2CID 109934776 Number Field Sieve wolfram com Retrieved 23 October 2015 Gidney Craig Shor s Quantum Factoring Algorithm Algorithmic Assertions Retrieved 28 November 2020 Roetteler Martin Naehrig Michael Svore Krysta M Lauter Kristin E 2017 Quantum resource estimates for computing elliptic curve discrete logarithms In Takagi Tsuyoshi Peyrin Thomas eds 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 Lecture Notes in Computer Science Vol 10625 Springer pp 241 270 arXiv 1706 06752 doi 10 1007 978 3 319 70697 9 9 Vandersypen Lieven M K Steffen Matthias Breyta Gregory Yannoni Costantino S Sherwood Mark H amp 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 Lu Chao Yang Browne Daniel E Yang Tao amp 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 Lanyon B P Weinhold T J Langford N K Barbieri M James D F V Gilchrist A amp 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 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 Martin Lopez Enrique Martin Lopez 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 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 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 156 arXiv 2012 07825 Bibcode 2021npjQI 7 156K doi 10 1038 s41534 021 00478 z ISSN 2056 6387 S2CID 229156747 Quantum computing motte and baileys Shtetl Optimized 2019 12 28 Retrieved 2021 11 15 Qiskit authors Qiskit Textbook Quantum Phase Estimation IBM Retrieved 7 November 2020 Shor 1999 p 14harvnb error no target CITEREFShor1999 help a b c d Nielsen Michael A Chuang Isaac L 9 December 2010 Quantum Computation and Quantum Information PDF 7th ed Cambridge University Press ISBN 978 1 107 00217 3 Archived PDF from the original on 2019 07 11 Retrieved 24 April 2022 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 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 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 Further reading EditNielsen Michael A amp 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 Bjorn Engquist Wilfried Schmid Springer 2001 ISBN 978 3 540 66913 5External links EditVersion 1 0 0 of libquantum contains a C language implementation of Shor s algorithm with their simulated quantum computer library but the width variable in shor c should be set to 1 to improve the runtime complexity PBS Infinite Series created two videos explaining the math behind Shor s algorithm How to Break Cryptography and Hacking at Quantum Speed with Shor s Algorithm Retrieved from https en wikipedia org w index php title Shor 27s algorithm amp oldid 1146995555, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.