1
$\begingroup$

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?

$\endgroup$
4
  • $\begingroup$ Hi and welcome to Quantum Computing SE. Which backend do you use? A real QPU or simulator? How many shots is used? $\endgroup$ Dec 17, 2022 at 6:43
  • $\begingroup$ What section of the Qiskit docs is this from? $\endgroup$ Dec 17, 2022 at 19:46
  • $\begingroup$ Your circuit is getting precisely the result it's supposed to. Why do you believe it calculates 7 * 4? $\endgroup$ Dec 18, 2022 at 2:51
  • $\begingroup$ Hi and thanks for your answers. This circuit is extract from the IBM quantum composer’s IBM user guide in « Shor’s algorithm » chapters (quantum-computing.ibm.com/composer/docs/iqx/guide/…). At the end of the article, there is a lot of example of 7xmod15. I understand the input x but I don’t know how to read the output. $\endgroup$
    – Jonah
    Dec 20, 2022 at 8:30

1 Answer 1

1
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.