2

I am trying to implement the order finding algorithm on Cirq finding the minimal positive $r$ for coprime $x$ and $N$ satisfying the equation $x^r \ = \ 1$(mod$ \ N$). In my case, I have set $x \ = \ 2$ and $N \ = \ 3$, so the algorithm should output $r \ = \ 2$. In order to implement the unitary, I simply observed that if we initialize the input that is being acted upon by the controlled-unitary matrices as a collection of $|1\rangle$ states, the unitary operation for this algorithm, $U|y\rangle \ = \ |2^jy \ $mod($3)\rangle$ acts trivially, in all circumstances, since $|y\rangle \ = \ |11\rangle \ = \ |3\rangle$. I feel as though I am missing a very important point, or maybe am not understanding the algorithm correctly, because when I try to implement the algorithm with no unitary gate (since it is supposedly trivial), the algorithm does not work.

Sanchayan Dutta
  • 17,945
  • 8
  • 50
  • 112
Jack Ceroni
  • 1,000
  • 7
  • 17

0 Answers0