Katherine E. Stange

Shor’s Algorithm

This demo shows the steps of Shor’s Algorithm.

The complex coefficients of each classical state are represented as a coloured bar.  The colour represents the phase, using the usual domain colouring standard as in the picture below (red = positive real direction, greeny-yellow = positive imaginary direction).  The height represents the complex absolute value.

The screen shows two quantum superpositions:

Pressing C/c advances/retreats the steps of the algorithm.  Recall that the goal of the algorithm is to find the period of the function xmapstoaxpmodNx \\mapsto a^x \\pmod N, which can (classically) be turned into a factorization of NN.

Once at Step 3, you can look at the QFT below to see the resulting quantum state.  This is the state you wish to measure to obtain the periodicity of axpmodNa^x \\pmod N.

Keyboard controls: