Use the positive-exponent quantum Fourier transform convention . The period of a function here is the least positive translation leaving the function unchanged on the cyclic group . The injective promise means exactly when . In particular : the subgroup of period translations is generated by , and wrapping the argument by preserves its value. This is exact quantum period finding on a finite cyclic group, rather than the truncated, nondividing-period version requiring continued fractions.
Prepare a uniform superposition state in the first quantum register using , and perform a reversible computation of the function into a second quantum register, cleaning its workspace by uncomputation:
A quantum measurement in the computational basis of the second quantum register leaves a periodic coset state in the first:
For the quantum Fourier transform of this periodic coset state, the finite geometric series vanishes unless the measured label is . On those labels its normalized amplitude is . Thus has the uniform distribution on a finite set on , irrespective of .
Compute the greatest common divisor by the Euclidean algorithm, and set , with . Since ,
The exact period recovery from a Fourier sample is therefore certified by testing . Every candidate divides and lies between and , so the injective promise makes that equality equivalent to . This includes , where the test uses input , and , which always succeeds. The test does not assert that an arbitrary equality of function values certifies an arbitrary period; the Fourier-derived divisor restriction is essential.
The concise result is
Here is the Euler totient function, with . The totient lower bound from the Mertens product gives for . Each trial uses polynomial time quantum Fourier transforms, function evaluations and Euclidean algorithm arithmetic in . Repeating independent trials gives constant success probability; the herald accepts only correct answers.
The printed asymptotic bound has the wrong direction for this argument. In Big O notation, the stated upper bound on the number of coprime integers supplies no success lower bound and is itself false uniformly: for prime , , not . Likewise the single-trial success need not be , since it tends to one for prime. The meaningful corrected guarantee is the lower bound above. If an upper-bounded success rate is literally required, one may deliberately retain an accepted result with an independent probability proportional to ; this discards useful successes and is unnecessary for efficient recovery.
The Euclidean algorithm repeatedly replaces a pair by without changing its greatest common divisor. Reversing the divisions expresses as an integer linear combination , which is Bézout's identity.
Here , and therefore
One solution is . It is not unique: for every , is another solution.
Starting with , define
while the denominator is nonzero. This gives the simple continued fraction
A finite expansion is rational by evaluating it from the bottom. Conversely, for rational , these steps are the Euclidean algorithm applied to numerator and denominator, so the remainders eventually vanish.
Define convergents by
The recurrence gives
so induction yields
In particular,
Since an irrational lies strictly between these convergents, the two approximation errors sum to this distance. If both displayed bounds in the question failed, their sum would be at least
by the arithmetic-geometric mean inequality, contradicting strict betweenness. Thus at least one bound holds.
Applying the Euclidean algorithm,
Hence . Since does not divide , the linear Diophantine equation solvability criterion gives
The linear Diophantine equation solvability criterion says that has an integer solution exactly when divides . The Euclidean algorithm gives
Thus , which divides . Therefore
If is an irreducible polynomial over a field , then a nonzero residue modulo has . The Euclidean algorithm supplies , giving inverse for . Thus the quotient ring is a field. If and has elements, polynomial division supplies exactly residue classes.