1

I don't understand this circuit's output from Qiskit's doc : 7*4%15. Indeed, the result should be 13, but output, I think I don't have the right method to read the result. I should have $|1101\rangle$ but we can see $|1110\rangle$ instead. Maybe the right result is report on the classical register but I don't know how to read it?

Martin Vesely
  • 15,244
  • 4
  • 32
  • 75
Jonah
  • 23
  • 3

1 Answers1

1

By the gate you made, the input isn't 4 |7x mod(15)> Note that my input. $$|x_1\rangle = |q_3 q_2 q_1 q_0\rangle $$ In the circuit you made, would be something like: $$ |x_2\rangle = |q_0 q_1 q_2 q_3\rangle $$ In conclusion, when $ |x_1\rangle = |0100\rangle = |4\rangle$, your state must be: $|x_2\rangle = |0010\rangle = |2\rangle $ for a equivalent output value.

So you can either change the input state to 2 or the second SWAP gate's positon

Martin Vesely
  • 15,244
  • 4
  • 32
  • 75