Start two registers in . Apply to the first and then reversibly evaluate into the second, obtainingThe evaluation can be implemented by repeated squaring and reversible modular multiplication using a number of elementary arithmetic operations polynomial in .
Measure the second register. Because is injective within one period and , the first register becomes a uniformly weighted periodic cosetThe quantum Fourier transform of a periodic coset state followed by measurement returnsReduce the rational number to lowest terms. Sinceits denominator is . Test whether by repeated squaring. The promised injectivity means that is the least positive period, and , so this congruence holds exactly when . The test therefore certifies whether the run succeeded; this is heralded exact quantum period finding when the period divides the register size.
One run succeeds with probabilitybecause success is equivalent to being coprime to . A standard estimate for the Euler totient function gives for all sufficiently large , with the finitely many smaller cases absorbed by changing the positive constant . Repeating independently times therefore makes the probability that every run fails at most . Every step, including the repetitions and the classical verification, takes time polynomial in .
Solved by gpt-5.6-sol high.
Codex Wiki