6 rows

Shor's Algorithm Classical Reduction Procedure

6 rows × 1 cols · as of 3 December 2026

Shor's algorithm factoring procedure is a short sequence of steps that turns the problem of splitting an odd, non-prime-power integer N into finding the multiplicative order of a random number modulo N.

The steps show how greatest common divisor checks can reveal a factor immediately, and how a quantum subroutine supplies the order when they do not.

The sequence also shows when to restart with a new random choice, such as when the order is odd or yields only a trivial factor.

Classical reduction
Pick a random number 1<a<N.
Compute K=gcd⁡(a,N), the greatest common divisor of a and N.
If K≠1, then K is a nontrivial factor of N, with the other factor being N/K, and we are done.
Otherwise, use the quantum subroutine to find the order r of a.
If r is odd, then go back to step 1.
Compute g=gcd⁡(N,ar/2+1). If g is nontrivial, the other factor is N/g, and we're done. Otherwise, go back to step 1.

Source: en.wikipedia.org/wiki/Shor's_algorithm, shared under CC BY-SA 4.0.

Updates: Latest edits

2 tables about Shor's algorithm

More: Tables like this · Random tables

All tables from Shor's algorithm

Classical reduction

  • Shor's Algorithm Classical Reduction Procedure

Further reading