Shor's algorithm is a landmark quantum algorithm introduced by Peter Shor in the mid-1990s. It provides a method to factor large integers or, equivalently, to compute the order of an element modulo N. The algorithm showed that a sufficiently powerful quantum computer could solve an important problem much faster than known classical algorithms, raising profound practical and theoretical questions.

Problem and goal

The algorithm addresses integer factorization: given a composite number N, find nontrivial prime factors. This task—finding prime factors—is the basis of widely used public-key schemes. Shor transformed factoring into an instance of order-finding, which a quantum processor can solve efficiently by exploiting superposition and interference.

How it works (high level)

At a conceptual level the quantum part performs period or order finding using the quantum Fourier transform. After preparing superposed states and applying a modular exponentiation operation, a quantum measurement yields information about the period. That information is then processed classically to recover factors. The major logical steps are:

  • Reduce factoring to finding the order r of a random integer a modulo N.
  • Use a quantum circuit to create a superposition and compute periodic sequence values.
  • Apply the quantum Fourier transform and measure to obtain data related to r.
  • Use classical postprocessing (continued fractions, gcd) to extract factors.

Complexity and implications

Shor's algorithm runs in polynomial time in the number of digits of N, a dramatic improvement over the best known classical methods whose running time grows superpolynomially for large N. Because the security of widely deployed systems such as RSA and other public-key schemes depends on the practical difficulty of factoring, a fully scalable quantum computer running Shor's algorithm would undermine many current cryptographic systems and has driven interest in quantum-resistant alternatives.

History, experiments and limitations

Since its discovery, Shor's algorithm has been demonstrated on small numbers in laboratory quantum devices, but scaling to the sizes needed to break modern keys requires large, fault-tolerant quantum machines and significant error correction overhead. Progress in qubit quality, coherence times and scalable architectures remains essential before the algorithm poses a real threat to deployed cryptography.

Uses, distinctions and further reading

Beyond its immediate cryptographic implications, Shor's algorithm is a central example in the study of quantum algorithms and complexity theory, illustrating how quantum resources can change computational difficulty classes. The result has motivated work in post-quantum cryptography and in alternative quantum algorithms for problems like discrete logarithms. For introductory surveys and technical expositions see further resources.