Quantum period finding (source code)

= Quantum period finding

For a function of period $r$ dividing $N$, prepare a uniform superposition of inputs, evaluate the function into a second register, and measure that register. The first register becomes a periodic coset state. Applying the <quantum Fourier transform> and measuring gives
$$
c=s\frac Nr,
\qquad 0\leq s<r.
$$