Quantum Fourier sampling of powers of three modulo ten (source code)

= Quantum Fourier sampling of powers of three modulo ten

The function $f(x)=3^x\bmod10$ on $\mathbb Z_{12}$ has period four. Measuring function value $3$ in its uniform input-output state leaves $(|1\rangle+|5\rangle+|9\rangle)/\sqrt3$. The quantum Fourier transform modulo twelve then returns each of $0,3,6,9$ with probability $1/4$.