Shor's algorithm: factoring and discrete logarithms
Algorithms and benchmarks / Factoring and cryptanalysis
Finds the prime factors of a large integer, or a discrete logarithm, in time that grows only polynomially with the number of digits. A large enough error-corrected quantum computer running it would break RSA and elliptic-curve public-key cryptography, which is why post-quantum cryptography is being deployed now.
- Era
- Fault-tolerant
- Problem class
- Factoring and cryptanalysis
- Speedup
- Superpolynomial over the best known classical factoring methods, whose running time grows faster than any polynomial in the number of digits (Shor 1997).
How it works
The problem is turned into finding the period of a modular function. A quantum register holds a superposition of inputs, the function is computed in superposition with reversible modular arithmetic, and the quantum Fourier transform reveals the period; ordinary computers finish the job.
Typical use cases
- Assessing when public-key cryptography (RSA, elliptic curves) could be broken, which sets the pace of the move to post-quantum cryptography.
Related pages
Resource estimates
Figures exactly as stated by their authors, with their assumptions. They are estimates under those assumptions, not forecasts, and they tend to fall as methods improve.
| Quantity | Value as stated |
|---|---|
| Noisy physical qubits | 20 million |
| Runtime | 8 hours |
| Logical qubits (formula for an n-bit integer) | 3n + 0.002 n lg n |
Assumptions: Physical gate error rate 10^-3, surface code cycle time 1 microsecond, control reaction time 10 microseconds, planar grid of qubits with nearest-neighbour connectivity.
Source: C. Gidney et al. 2021, Quantum 5, 433 (2021); arXiv:1905.09749
| Quantity | Value as stated |
|---|---|
| Noisy physical qubits | fewer than one million |
| Runtime | less than a week |
Assumptions: The same hardware assumptions as Gidney and Ekerå (2021): uniform gate error rate 0.1%, surface code cycle time 1 microsecond, control system reaction time 10 microseconds, square grid with nearest-neighbour connections. The longer runtime comes mainly from more Toffoli gates and fewer magic state factories.
Source: C. Gidney 2025, arXiv:2505.15917 (preprint, May 2025)
| Quantity | Value as stated |
|---|---|
| Physical qubits in the processor | 13,436 |
| Memory | 28 million spatial modes and 45 temporal modes |
| Runtime | 177 days |
Assumptions: Physical gate error rate 10^-3, processor cycle time 1 microsecond, 3D gauge colour codes with a 0.75% threshold, superconducting processor linked by a microwave interface to a photon-echo memory in rare-earth-ion-doped solids with a 2-hour storage time (a 1-second storage time adds about 23% to the runtime).
Source: É. Gouzien et al. 2021, Phys. Rev. Lett. 127, 140503 (2021); arXiv:2103.06159
| Quantity | Value as stated |
|---|---|
| Cat qubits | 126,133 |
| Runtime | 9 hours |
Assumptions: Ratio between single- and two-photon losses of 10^-5, cycle time 500 ns, about 19 photons per cat state on average, 2D grid with nearest-neighbour connectivity, repetition code against phase errors, lattice surgery and off-line magic states for Toffoli gates.
Source: É. Gouzien et al. 2023, Phys. Rev. Lett. 131, 040602 (2023); arXiv:2302.06639
| Quantity | Value as stated |
|---|---|
| Logical qubits (upper bound) | 2,330 |
| Toffoli gates (upper bound) | about 1.29 × 10^11 |
Assumptions: Logical-level counts with no error-correction overhead. The portal evaluated the formulas stated in the abstract, 9n + 2⌈log2 n⌉ + 10 qubits and 448 n^3 log2 n + 4090 n^3 Toffoli gates, at n = 256.
Source: M. Roetteler et al. 2017, ASIACRYPT 2017; arXiv:1706.06752
| Quantity | Value as stated |
|---|---|
| Toffoli gates per key | about 50 million |
Assumptions: Logical Toffoli count from the title of the paper; its hardware figures assume a fault-tolerant surface-code machine in an active-volume architecture with non-local connections between modules and a 10 microsecond code cycle.
Source: D. Litinski 2023, arXiv:2306.08585 (preprint, June 2023)
Demonstrations
- 2016: The number 15 was factored with a scalable Shor circuit on seven trapped-ion qubits plus four cache qubits, with a success probability above 90%. (T. Monz et al. 2016)
- 2025: The KPI booklet of the Quantum Flagship gives 15 as the largest reliable instance of Shor’s algorithm on an EU computing system for 2023 and 2024 (KPI Comp 2c). (Quantum Flagship Strategic Advisory Board 2025)
Hardware platforms that fit
- Superconducting qubits: The RSA-2048 estimates of Gidney and Ekerå (2021) and Gidney (2025) assume a square or planar grid of qubits with nearest-neighbour connections and a 1 microsecond surface code cycle, the layout of superconducting chips; the cat-qubit estimate of Gouzien et al. (2023) also uses a superconducting-circuit architecture.
- Trapped ions: Fifteen was factored with a scalable version of the algorithm on an ion-trap computer (Monz et al. 2016).
- Photonic qubits: Litinski (2023) sets out the elliptic-curve estimate for a fault-tolerant machine in a silicon-photonics-inspired 'active-volume' architecture.
What you need to run it
- Classical simulation
- Only toy instances: factoring 15 needs a few qubits and simulates on a laptop. Cryptographic sizes need thousands of logical qubits, far beyond any classical simulation.
- Noisy hardware (NISQ)
- Not applicable for this family.
- Fault-tolerant machine
- Thousands of logical qubits, Toffoli counts from tens of millions upwards and magic state factories; under the cited assumptions, from under a million to 20 million physical qubits for RSA-2048, or about 126,000 cat qubits for a 256-bit elliptic curve.
- Annealer or analogue simulator
- Not applicable for this family.
Calculate the memory of a simulation
Where to run it in Europe
Superconducting qubits
- VLQ (Czechia; Inaugurated, per the EuroHPC JU): Superconducting; digital quantum computer. Access: EuroHPC JU call for quantum access in pilot mode. Deployment milestones VLQ
- Euro-Q-Exa (Germany; Inaugurated, per the EuroHPC JU): Superconducting; digital quantum computer. Access: EuroHPC JU call for quantum access in pilot mode. Deployment milestones Euro-Q-Exa
- EuroQCS-Spain (Spain; Inaugurated, per the EuroHPC JU): Superconducting annealing; analogue quantum computer. Access: EuroHPC JU call for quantum access in pilot mode. Deployment milestones EuroQCS-Spain
- Quantum Inspire (Netherlands; In operation, per the source): Online platform with superconducting transmon QPUs, a neutral-atom emulator and simulators; a Spin-2+ electron spin QPU is listed as archived. Access: Quantum Inspire registration.
- LRZ Quantum Integration Centre (QIC) (Germany; In operation, per the source): Superconducting systems from IQM (54 qubits, up to 150 in future), a 20-qubit AQT ion-trap system, and a neutral-atom system being developed by planqc (MAQCS project). Access: LRZ quantum computing consulting.
- Finnish Quantum-Computing Infrastructure (FiQCI) (Finland; In operation, per the source): Hybrid HPC and quantum computing platform: VTT Q50 (53 qubits) and Aalto Q20 (20 qubits), superconducting systems made by IQM, used through the LUMI supercomputer environment. Access: FiQCI calls for academic projects.
- Quantum Spain quantum computer at BSC-CNS (Spain; In operation, per the source): Superconducting; digital quantum computer with a 35-qubit processor, integrated into the MareNostrum 5 supercomputer. Access: Spanish Supercomputing Network (RES) quantum access. Deployment milestones Quantum Spain quantum computer at BSC-CNS
Trapped ions
- Piast-Q (Poland; Inaugurated, per the EuroHPC JU): Trapped ions; digital quantum computer. Access: EuroHPC JU call for quantum access in pilot mode. Deployment milestones Piast-Q
- LRZ Quantum Integration Centre (QIC) (Germany; In operation, per the source): Superconducting systems from IQM (54 qubits, up to 150 in future), a 20-qubit AQT ion-trap system, and a neutral-atom system being developed by planqc (MAQCS project). Access: LRZ quantum computing consulting.
Photonic qubits
- Lucy (France; Inaugurated, per the EuroHPC JU): Photonic; digital quantum computer. Access: EuroHPC JU call for quantum access in pilot mode. Deployment milestones Lucy
- France Hybrid HPC Quantum Initiative (HQI) platform (France; In operation, per the source): Hybrid HPC–quantum platform coupled to the Joliot-Curie supercomputer: Ruby (analogue neutral-atom system controlling 100 rubidium atoms), Lucy (12-photon photonic QPU) and Qaptiva QPU emulation. Access: GENCI eDARI resource allocation requests. Deployment milestones France Hybrid HPC Quantum Initiative (HQI) platform
The full infrastructure catalogue · The infrastructure deployment tracker
Software
European tools in the software directory
A listing is not an endorsement; check each tool for the features you need.
Limitations and open questions
- Every cited estimate for cryptographically relevant sizes assumes error-corrected hardware far larger than any machine built so far.
- Estimates fall as methods improve: under the same hardware assumptions the RSA-2048 figure went from 20 million noisy qubits (Gidney and Ekerå, arXiv 2019, published 2021) to fewer than one million (2025 preprint).
- Demonstrations so far factor numbers that ordinary computers factor instantly; they test hardware and compilers, not cryptographic risk.
In the Quantum Algorithm Zoo
- Factoring (Quantum Algorithm Zoo, external site): Algebraic and Number Theoretic Algorithms; speedup as the Zoo states it: Superpolynomial
- Discrete-log (Quantum Algorithm Zoo, external site): Algebraic and Number Theoretic Algorithms; speedup as the Zoo states it: Superpolynomial
Index: the Quantum Algorithm Zoo by Stephen P. Jordan, last updated 2026-09-10, checked 2026-10-23. The portal links to it and copies no description from it. Browse the full Quantum Algorithm Zoo (external site)
Named in European procurements
None of the procurement documents read for this release names it.
Sources
- P. W. Shor (1997). Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer. SIAM Journal on Computing 26, 1484 (1997); arXiv:quant-ph/9508027. Read: abstract page, retrieved 2026-10-23.
- C. Gidney, M. Ekerå (2021). How to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits. Quantum 5, 433 (2021); arXiv:1905.09749. Read: abstract page, retrieved 2026-10-23.
- C. Gidney (2025). How to factor 2048 bit RSA integers with less than a million noisy qubits. arXiv:2505.15917 (preprint, May 2025). Read: abstract page, retrieved 2026-10-23.
- É. Gouzien, D. Ruiz, F.-M. Le Régent, J. Guillaud, N. Sangouard (2023). Performance Analysis of a Repetition Cat Code Architecture: Computing 256-bit Elliptic Curve Logarithm in 9 Hours with 126133 Cat Qubits. Phys. Rev. Lett. 131, 040602 (2023); arXiv:2302.06639. Read: abstract page, retrieved 2026-10-23.
- D. Litinski (2023). How to compute a 256-bit elliptic curve private key with only 50 million Toffoli gates. arXiv:2306.08585 (preprint, June 2023). Read: abstract page, retrieved 2026-10-23.
- T. Monz, D. Nigg, E. A. Martinez, M. F. Brandl, P. Schindler, R. Rines, S. X. Wang, I. L. Chuang, R. Blatt (2016). Realization of a scalable Shor algorithm. Science (2016), DOI 10.1126/science.aad9480; arXiv:1507.08852. Read: abstract page, retrieved 2026-10-23.
- É. Gouzien, N. Sangouard (2021). Factoring 2048-bit RSA Integers in 177 Days with 13436 Qubits and a Multimode Memory. Phys. Rev. Lett. 127, 140503 (2021); arXiv:2103.06159. Read: abstract page, retrieved 2026-10-23.
- M. Roetteler, M. Naehrig, K. M. Svore, K. Lauter (2017). Quantum resource estimates for computing elliptic curve discrete logarithms. ASIACRYPT 2017; arXiv:1706.06752. Read: abstract page, retrieved 2026-10-23.
- Quantum Flagship Strategic Advisory Board (2025). Quantum Flagship Strategic Advisory Board: KPI booklet (March 2025). Booklet read for the KPI observatory. Read: booklet (see the KPI observatory), retrieved 2026-10-23.