For a function of period dividing , 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
Codex Wiki