Shor's Algorithm
Shor's algorithm shows how quantum computers could factor large integers efficiently, threatening cryptographic systems such as RSA.
Explore books and products on Amazon
As an Amazon Associate, LinkPods earns from qualifying purchases.
Amazon · paid link
Books
Reading about Shor's Algorithm
Browse on AmazonAmazon · paid link
Gear and gadgets
Related devices and accessories
Browse on Amazon
Links open Amazon search results; LinkPods has not reviewed the items listed there.
Shor’s algorithm is a method for using a quantum computer to break an integer down into its prime factors. American mathematician Peter Shor developed it in 1994. The name most often means his factoring method, although it can also describe related methods for discrete logarithms and finding periods. These connections make periodic behavior central to understanding how the algorithm works.
The factoring procedure combines ordinary computation with a quantum calculation. Classical steps first handle easier cases and select a number smaller than the integer being factored. If the two numbers already share a divisor greater than one, that gives a factor immediately. Otherwise, the quantum part searches for the smallest positive exponent that makes the selected number’s power leave a remainder of one when divided by the target integer. This exponent is called its order.
The quantum calculation uses phase estimation to obtain information about that order, followed by continued fractions to recover it. Classical arithmetic then attempts to turn the order into factors. Some results require trying another selected number. On an ideal quantum computer, the overall computation takes time that grows polynomially with the number of digits needed to represent the input, unlike any known classical factoring algorithm.
This difference matters because RSA security depends on large integers being difficult to factor. Shor’s work also describes methods that threaten Diffie–Hellman systems, helping motivate quantum-computer development and research into post-quantum cryptography. Practical use remains difficult: correcting quantum errors could require millions of qubits. The source reports that, as of 2026, experiments had achieved only small examples and succeeded on only some attempts. It also cautions that demonstrations used advance knowledge of the factors to simplify their circuits, rather than meeting the full algorithm’s requirements.
Common questions
Who invented Shor’s algorithm, and when?
Peter Shor, an American mathematician, developed Shor’s algorithm in 1994. His work included related quantum methods for factoring, discrete logarithms, and finding periods.
How does Shor’s algorithm factor numbers?
Shor’s algorithm uses classical arithmetic to turn factoring into an order-finding task, then uses a quantum calculation to find the order. Further classical calculations try to extract factors from that result. If the result is unsuitable, the procedure can restart with a different selected number.
Why is Shor’s algorithm a threat to RSA?
Shor’s algorithm threatens RSA because it makes efficient factoring possible on an ideal quantum computer. RSA can be defeated if the large integers involved can be factored. Carrying out that attack would require enough qubits and sufficient protection against quantum noise.
Is Shor’s algorithm faster than classical factoring algorithms?
Shor’s algorithm has better asymptotic performance than the general number field sieve, the most scalable classical factoring method described in the source. Its quantum running time is polynomial in the logarithm of the integer being factored. However, the overhead of quantum error correction could mean that beating classical computers requires millions of qubits.
Has Shor’s algorithm been demonstrated on a quantum computer?
Experiments have demonstrated small factoring examples associated with Shor’s algorithm, including an IBM experiment in 2001 that factored 15 using seven qubits. Other demonstrations used photonic, solid-state, and trapped-ion qubits. However, the source cautions that these experiments simplified their circuits using prior knowledge of the answers and did not meet the full algorithm’s requirements.
Where this leads
Select any dot to open that topic. The outer ring shows where each connection leads next.
Integer Factorization →
Shor's algorithm solves integer factorization in polynomial time on a quantum computer, with runtime measured against the integer's number of bits.
Integer Factorization →
Shor's algorithm uses quantum order-finding and classical arithmetic to find nontrivial factors of composite integers.
RSA Encryption (Rivest–Shamir–Adleman) →
Factoring an RSA public key's modulus with Shor's algorithm would allow an attacker to calculate the corresponding private key.