Input
Black box for a function
Output
Return
Algorithm
Construct
Consider a state
Apply the quantum oracle of the function
Since
Do a measurement on the second register of basis
Let outcome be
Probability of outcome
Terms contributing to this outcome are
By the extended Born Rule
So the measurement gives a uniformly random outcome
Post measurement state of the first register is
We apply Quantum Fourier Transform
We can calculate
Thus
Measurement on the first register in
Say outcome is
We try
Coprimality Theorem
So repeat this