2
$\begingroup$

I have implemented Shor's algorithm for $N=15$ from this tutorial. I understand the algorithm pretty well, but I'm a little confused at the output I'm getting from running the circuit. It appears to be all over the place. The function $\text{qpe_amod15}$ seems to take the zero-th reading and use that phase and extracted period, which has resulted in successful factorizations so far.

Does this look normal or am I just getting lucky?

quantum phase estimation output register phase data period extraction]

$\endgroup$

1 Answer 1

1
$\begingroup$

This looks quite odd, so I would say that something is wrong with your implementation and that you are just getting lucky. (Note that for such a small example, it is quite probable that you would get lucky, even if the quantum circuit only outputs random values.)

You would expect to observe a frequency $j \in \{ 0, 64, 128, 192 \}$, if your control register is of length $8$ qubits, and your generator is $g = 7$, which has order $r = 4$ in $\mathbb Z_N^*$ where $N = 15$.

This answer to a similar question may be useful to build up your understanding. When the control register is of length $8$ qubits instead of $6$ qubits as in said answer, the frequencies are scaled up by a factor of $2^{8-6} = 4$, but otherwise the situation is analogous.

$\endgroup$

Your Answer

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

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