Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Experimental realization of Shor's quantum factoring algorithm using qubit recycling


Quantum computational algorithms exploit quantum mechanics to solve problems exponentially faster than the best classical algorithms1,2,3. Shor's quantum algorithm4 for fast number factoring is a key example and the prime motivator in the international effort to realize a quantum computer5. However, due to the substantial resource requirement, to date there have been only four small-scale demonstrations6,7,8,9. Here, we address this resource demand and demonstrate a scalable version of Shor's algorithm in which the n-qubit control register is replaced by a single qubit that is recycled n times: the total number of qubits is one-third of that required in the standard protocol10,11. Encoding the work register in higher-dimensional states, we implement a two-photon compiled algorithm to factor N = 21. The algorithmic output is distinguishable from noise, in contrast to previous demonstrations. These results point to larger-scale implementations of Shor's algorithm by harnessing scalable resource reductions applicable to all physical architectures.

Access options

Rent or Buy article

Get time limited or full article access on ReadCube.


All prices are NET prices.

Figure 1: The iterative order-finding algorithm for factoring 21.
Figure 2: Compiled iterative order-finding algorithm.
Figure 3: Demonstration of order finding.


  1. 1

    Feynman, R. P. Simulating physics with computers. Int. J. Theor. Phys. 21, 467–488 (1982).

    MathSciNet  Article  Google Scholar 

  2. 2

    Deutsch, D. Quantum theory, the Church–Turing principle and the universal quantum computer. Proc. R. Soc. Lond. A 400, 97–117 (1985).

    ADS  MathSciNet  Article  Google Scholar 

  3. 3

    Nielsen, M. A. & Chuang, I. L. Quantum Computation and Quantum Information (Cambridge Univ. Press, 2000).

    MATH  Google Scholar 

  4. 4

    Shor, P. W. in Proceedings of the 35th Annual Symposium on Foundations of Computer Science (ed. Goldwasser, S.) 124–134 (IEEE Computer Society Press, 1994).

  5. 5

    Ladd, T. D. et al. Quantum computers. Nature 464, 45–53 (2010).

    ADS  Article  Google Scholar 

  6. 6

    Vandersypen, L. M. K. et al. Experimental realization of Shor's quantum factoring algorithm using nuclear magnetic resonance. Nature 414, 883–887 (2001).

    ADS  Article  Google Scholar 

  7. 7

    Lu, C-Y., Browne, D. E., Yang, T. & Pan, J-W. Demonstration of a compiled version of Shor's quantum factoring algorithm using photonic qubits. Phys. Rev. Lett. 99, 250504 (2007).

    ADS  Article  Google Scholar 

  8. 8

    Lanyon, B. P. et al. Experimental demonstration of a compiled version of Shor's algorithm with quantum entanglement. Phys. Rev. Lett. 99, 250505 (2007).

    ADS  Article  Google Scholar 

  9. 9

    Politi, A., Matthews, J. C. F. & O'Brien, J. L. Shor's quantum factoring algorithm on a photonic chip. Science 325, 1221 (2009).

    ADS  MathSciNet  Article  Google Scholar 

  10. 10

    Parker, S. & Plenio, M. B. Efficient factorization with a single pure qubit and logN mixed qubits. Phys. Rev. Lett. 85, 3049–3052 (2000).

    ADS  Article  Google Scholar 

  11. 11

    Mosca, M. & Ekert, A. in Lecture Notes in Computer Science Vol. 1509, 174–188 (Springer, 1999).

    MATH  Google Scholar 

  12. 12

    Aspuru-Guzik, A., Dutoi, A. D., Love, P. J. & Head-Gordon, M. Simulated quantum computation of molecular energies. Science 309, 1704–1707 (2005).

    ADS  Article  Google Scholar 

  13. 13

    Lanyon, B. P. et al. Towards quantum chemistry on a quantum computer. Nature Chem. 2, 106–111 (2010).

    ADS  Article  Google Scholar 

  14. 14

    Veis, L. & Pittner, J. Quantum computing applied to calculations of molecular energies: CH2 benchmark. J. Chem. Phys. 133, 194106 (2010).

    ADS  Article  Google Scholar 

  15. 15

    Whitfield, J. D., Biamonte, J. & Aspuru-Guzik, A. Simulation of electronic structure Hamiltonians using quantum computers. Mol. Phys. 109, 735–750 (2011).

    ADS  Article  Google Scholar 

  16. 16

    Li, Z. et al. Solving quantum ground-state problems with nuclear magnetic resonance. Sci. Rep. 1, 88 (2011).

    Article  Google Scholar 

  17. 17

    Griffiths, R. B. & Niu, C-S. Semiclassical Fourier transform for quantum computation. Phys. Rev. Lett. 76, 3228–3231 (1996).

    ADS  Article  Google Scholar 

  18. 18

    Beckman, D., Chari, A. N., Devabhaktuni, S. & Preskill, J. Efficient networks for quantum factoring. Phys. Rev. A 54, 1034–1063 (1996).

    ADS  MathSciNet  Article  Google Scholar 

  19. 19

    Prevedel, R. et al. High-speed linear optics quantum computing using active feed-forward. Nature 445, 65–69 (2007).

    ADS  Article  Google Scholar 

  20. 20

    Zhou, X-Q. et al. Adding control to arbitrary unknown quantum operations. Nature. Commun. 2, 413 (2011).

    ADS  Article  Google Scholar 

  21. 21

    Ralph, T. C., Langford, N. K., Bell, T. B. & White, A. G. Linear optical controlled-NOT gate in the coincidence basis. Phys. Rev. A 65, 062324 (2001).

    ADS  Article  Google Scholar 

  22. 22

    Hofmann, H. F. & Takeuchi, S. Quantum phase gate for photonic qubits using only beam splitters and postselection. Phys. Rev. A 66, 024308 (2001).

    ADS  Article  Google Scholar 

  23. 23

    O'Brien, J. L., Pryde, G. J., White, A. G., Ralph, T. C. & Branning, D. Demonstration of an all-optical quantum controlled-NOT gate. Nature 426, 264–267 (2003).

    ADS  Article  Google Scholar 

  24. 24

    O'Brien, J. L. et al. Quantum process tomography of a controlled-NOT gate. Phys. Rev. Lett. 93, 080502 (2004).

    ADS  Article  Google Scholar 

  25. 25

    Kwiat, P. G., Waks, E., White, A. G., Appelbaum, I. & Eberhard, P. H. Ultrabright source of polarization-entangled photons. Phys. Rev. A 60, R773–R776 (1999).

    ADS  Article  Google Scholar 

  26. 26

    Knill, E., Laflamme, R. & Milburn, G. J. A scheme for efficient quantum computation with linear optics. Nature 409, 46–52 (2001).

    ADS  Article  Google Scholar 

Download references


The authors thank S. Bartlett, R. Jozsa, G. McConnell, T. Ralph, T. Rudolph and P. Shadbolt for helpful discussions. This work was supported by the Engineering and Physical Sciences Research Council (EPSRC), the European Research Council (ERC), PHORBITECH and the Centre for Nanoscience and Quantum Information (NSQI). J.O.B. acknowledges a Royal Society Wolfson Merit Award.

Author information




The theory was developed by T.L. and A.L. The theory was mapped to the experimental circuit by A.L., T.L., E.M.-L., X.Z. and J.O.B. Experiments were performed by E.M.-L., T.L., A.L., R.A. and X.Z. Data were analysed by A.L., E.M.-L., T.L., X.Z. and J.O.B. The manuscript was written by A.L., T.L., E.M.-L., X.Z. and J.O.B. The project was supervised by A.L. and J.O.B.

Corresponding author

Correspondence to Jeremy L. O'Brien.

Ethics declarations

Competing interests

The authors declare no competing financial interests.

Supplementary information

Supplementary information

Supplementary information (PDF 425 kb)

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Martín-López, E., Laing, A., Lawson, T. et al. Experimental realization of Shor's quantum factoring algorithm using qubit recycling. Nature Photon 6, 773–776 (2012).

Download citation

Further reading


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing