\section{Experimental realization of Shor's
quantum factoring algorithm using nuclear magnetic resonance}
In the article \cite{nature} by L. M. K. Vandersypen et. al. a experimental quantum computing setup for computation of the prime factors of a given number using Shor's algorithm is presented. In a classical computer, the number of steps for finding the factors of an $l$-digit integer $N$ increases exponentially with $l$. However, a quantum computer using Shor's algorithm, can make the same factorization in polynomial time, thereby decreasing the computation time from years to minutes. In \cite{nature} $N=15$, hence the prime factors are $3$ and $5$. The setup is based on measuring the spin of seven spin-1/2 nuclei in a molecule using room temperature liquid-state nuclear magnetic resonance (or NMR)
\subsection{Shor's algorithm}
The problem of factoring a given integer into primes can be formulated as finding an integer $p$ that divides $N$, where $1<p<N$.
Shor's Algorithm consists of two parts. The first part is to turn the factoring problem into a period finding problem, while the second part is to find the period, $r$, using an inverse quantum Fourier transformation (QFT). When the period is found, it is inserted into the part one problem and the prime factors are found immediately. 

We start by considering the function
\begin{eqnarray}
\label{eqn:mod}
f(x)=a^x \textrm{ mod } N,
\end{eqnarray}
i.e. the remainder of $a^x$ divided by $N$, or in other words, the smallest integer $r$ for which $f(x+r)=f(x)$. $a$ is randomly chosen with the restriction that $a<N$. The problem now is to find $r$ that satisfy Equation \ref{eqn:mod}.  We start out with n qubits, in the initial state \cite{wikishor}
\begin{eqnarray}
\frac{1}{\sqrt{n}}\sum_{x=0}^{n-1}\ket{x}\ket{0}.
\end{eqnarray}
Applying the function $f(x)$ we get
\begin{eqnarray}
\frac{1}{\sqrt{n}}\sum_{x=0}^{n-1}\ket{x}\ket{f(x)}.
\end{eqnarray}
When using quantum computing, applying $f(x)$ once will apply it to all states, thus parallizing the process, hence decreasing the computation time considerable, compared to classical methods. If one tried to measure the resulting superposition the state would collapse and information would be lost. We therefore apply the inverse QTF
\begin{eqnarray}U_{QFT}\ket{x}=\frac{1}{\sqrt{n}}\sum_{y=0}^{n-1}\exp^{-2\pi ixy/n}\ket{y},
\end{eqnarray}
thereby getting the state
\begin{eqnarray}
\frac{1}{\sqrt{n}}\sum_{x=0}^{n-1}\sum_{y=0}^{n-1}\exp^{-2\pi ixy/n}\ket{y}\ket{f(x)}.
\end{eqnarray}
If a measurement is made now, so that the input and output register will hold the outcome $y$ and $f(x_0)$, respectively, it can be shown that $y$ can only take values that are a multiple of $2^n/r$. If the obtained result, which is only a qualified guess and therefore denoted $r'$, does not satisfy $f(x)=f(x+r')$, the correct $r$, is found by trying multiples of $r'$. Finally the factors of $N$ is found by calculating the greatest common denominator (gcd) of $a^{r/2}\pm 1$ and $N$\footnote{See \cite{wikishor} for the mathematical proof}.
\subsection{Quantum computing molecule}
In the setup used in \cite{nature}, the quantum computations is done by a molecule consisting of five $^{19}F$ and two $^{13}C$ spin-1/2 nuclei, see Figure \ref{fig:fcmolecule}.
\begin{figure}
\centering
\includegraphics[scale=0.25]{qubitmolecule.eps}
\caption{The molecule,a perfluorobutadienyl iron complex, used for quantum computations consists of five $^{19}F$ and two $^{13}C$ spin-1/2 nuclei. The molecule is placed in a static magnetic field, hence the spins has only two discrete eigenstates. \label{fig:fcmolecule}}
\end{figure}
 If the molecule is placed in a static magnetic field, each spin, $i$, has only two separate eigenstates, $\ket{0}$ or $ket{1}$ (spin up or spin down), i.e. 7 qubits. Since $N=15$, four of the qubits are be used for storing $f(x)$, while the remaining three are used for the QFT. The hamiltonian for the molecule in the magnetic field is
\begin{eqnarray}
H_0=-\sum_i \hbar\omega_i I_{zi},
\end{eqnarray}
where $\omega_i$ is the angular frequency and $I_z$ is the $\hat{z}$ component of the angular momentum of the $i^{\textrm{th}}$ spin. The density matrix for the molecule is initially determined by the thermal equilibrium, that is
\begin{eqnarray}
\rho_{th}=\frac{\exp{-H_0/k_bT}}{2^7}.
\end{eqnarray}
The pariwise interaction of the 7 spins through the chemical bonds, that is the J-couplin, is given by
\begin{eqnarray}
H_J=-\sum_{i<j}2\pi \hbar J_{ij}I_{zi} I_{zj},
\end{eqnarray}
Using spin-selective radio frequency pulses separated by time intervals of free evolution under the hamiltonian, the system can be manipulated into another computational state. The actual state of the three first qubits is estimated using NMR spectroscopy, using that
\begin{eqnarray}
\rho\sim\sum_cw_c\ket{c\frac{2^3}{r}}\bra{c\frac{2^3}{r}}
\end{eqnarray}
Before starting the Shor algorithm, the system is brought into a 7-spin effective pure state, using temporal averaging, with a NMR signal equivalent to $\ket{\psi}=\ket{0000001}$, see a) and b) on Figure \ref{fig:NMR}.
\begin{figure}
\centering
\includegraphics[scale=0.5]{NMR.eps}
\caption{Nuclear magnetic resonance (NMR) measurements of the first three qubits. a) is when the system is in thermal equilibrium. b) is when the system has been prepared for Shor's algorithm using temporal averaging. c) and d) is the output for $a=11$ and $a=7$, respectively. Both c) and d) has three traces where the top ones are the ideally expected results, the middle traces are the measured data and the bottom traces are simulated data with the effect of decoherence taken into account   \label{fig:NMR}}
\end{figure}
The computer is tested for two different choices of $a$, namely $a=11$ and $a=7$. The results are shown on Figure \ref{fig:NMR} c) and d). For $a=11$ it is seen that qubit 1 and 2 has two spectral peaks pointing upwards, hence they are in the $\ket{0}$ state, while qubit 3 has a peak up and a peak down, hence it is in an equal mixture of $\ket{0}$ and $\ket{1}$. The readout register is therefore in a mixture of $\ket{000}$ and $\ket{100}$ (qubit 3 is the first bit), or $\ket{0}$ and $\ket{4}$ in decimal notation. $r$ can now be found as $r=2^n/4=2$, and gcd($11^{2/2}\pm1,N$) the yields the two prime factors $5$ and $3$. Similarly for the $a=7$ case, where qubit 1 is in the $\ket{0}$ state, and qubit 2 and three are both in a mixed state. The readout register is therefore $\ket{100}$, $\ket{110}$, $\ket{010}$ and $\ket{000}$ or $\ket{6}$, $\ket{4}$, $\ket{2}$ and $\ket{0}$. This gives $r=2^n/2=4$ and the prime factors are again gcd($7^{4/2}\pm1,15$)=\{3,5\}. Comparing the top and bottom simulated results in c) and d) on Figure \ref{fig:NMR} it is also seen that decoherence has too be taken into account when trying to describe the system, although there still are some deviations from the theoretically expected results. These deviations is partly due approximations in the model, partly due to imperfections in the experimental setup.

