Shor's factoring algorithm uses quantum period finding to determine a modular order and then extracts factors classically with greatest common divisors.
After continued-fraction recovery in quantum order finding, an even candidate denominator can be used to try the displayed greatest common divisors. Return only a divisor strictly between one and . If is the true even multiplicative order with a nontrivial halfway power, success follows from factor extraction from an even modular order. A candidate that is not a period can occasionally still yield a factor; testing before the gcds therefore changes single-run success probabilities. The output-factor check guarantees correctness in either convention.
If is even, , and , then is a nontrivial factor unless the order was not minimal.
For an odd integer having at least two distinct prime divisors, choose a uniform unit . The Chinese remainder theorem for unit groups makes its odd-prime-power components independent cyclic groups. Failure of factor extraction from an even modular order requires all components to have equal 2-primary order exponents. For any component each possible exponent has probability at most , so conditioning on another component bounds failure by . Excluding the identity unit only improves the success proportion.
Quantum order finding Fourier-transforms a superposition of arguments having the same modular-exponentiation value, producing peaks near multiples of the reciprocal period.
For and order , multiplication by modulo is a unitary operator. On the orbit of one it cyclically permutes basis states. The displayed orthonormal eigenstates have eigenvalues , and . Thus quantum phase estimation on this efficiently prepared state samples a uniform without knowing . Controlled powers are implemented by quantum modular exponentiation. Sufficient phase resolution allows continued-fraction recovery in quantum order finding; the reduced denominator equals only when is coprime to .
In quantum order finding, a phase produces amplitude after an inverse quantum Fourier transform. Its nearest grid point has probability at least , by bounding the sine ratio of this finite geometric Fourier amplitude. The initial modular orbit state is an equal-weight superposition of the phase eigenstates, so the phase label is uniform.
Quantum modular exponentiation is the reversible computation that maps
It can be implemented in polynomial time in the bit lengths of and by repeated squaring and controlled modular multiplication.
The Fourier amplitude of equally spaced basis states is a finite geometric sum with peaks where the Fourier phase increment is nearly one.
For terms with phase ratio , the amplitude factor is , with limiting value when .
If a measured ratio approximates a reduced within , continued-fraction convergents recover the candidate denominator .
Two distinct reduced fractions with denominators below differ by more than , so an interval of radius contains at most one.

Articles by others on the same topic (2)

Shor's algorithm is a quantum algorithm developed by mathematician Peter Shor in 1994 for efficiently factoring large integers. It is significant because factoring large numbers is a fundamental computational problem that underpins the security of many classical cryptographic systems, such as RSA (Rivest-Shamir-Adleman) encryption. The classical methods for factoring integers are inefficient for large numbers, typically requiring exponential time in the size of the number.