Given a number
We try to use Periodicity Determination on a function
If
As
Now
This is likely to succeed.
Finding the period
Let
Pick a random integer
We try to implement Periodicity Determination of
Start from state
Apply
Apply the quantum oracle
We measure the last register leaving the state in:
for some
Apply
Now we need to look closely into
in particular, we want
In that case,
Note that there is a unique integer
The probability of measuring such
We do have
Given some
We find the Continued Fraction of
Checking it’s convergents we look for
and
Having found one such
We can easily check this.
If we are lucky, we can apply the reasoning at the start of this page (otherwise, repeat the whole process with a different