Quantum ComputingAlgorithmsUniversity
AQAAPOntarioNSWCBSEGCE O-LevelMoECAPS

Shor's Algorithm (Period Count) Calculator

Relationship between period 'r' and the number of qubits 'n' for integer factoring.

Use the free calculatorCheck the variablesOpen the advanced solver
This is the free calculator preview. Advanced walkthroughs stay in the app.
Result
Ready
Required Qubits

Formula first

Overview

Shor's algorithm uses quantum phase estimation to find the period of modular exponentiation, a crucial step for factoring integers. To achieve the necessary precision for the continued fraction algorithm to succeed, the work register size (n) must be approximately double the bit-length (k) of the number being factored (N).

Symbols

Variables

n = Required Qubits, N = Integer to Factor

Required Qubits
Integer to Factor

Apply it well

When To Use

When to use: This formula is applied when determining the hardware requirements for the quantum period-finding routine. It specifically dictates the size of the first register (the precision register) needed to resolve the phase of the unitary operator to sufficient accuracy.

Why it matters: This relationship defines the scalability of quantum attacks on RSA encryption. Because n is proportional to the bit-length of N, doubling the encryption key size effectively doubles the number of qubits required in the precision register, highlighting the resource-intensive nature of quantum cryptanalysis.

One free problem

Practice Problem

If you are using Shor's algorithm to factor the number 15, what is the required number of qubits (n) in the first register?

Integer to Factor15

Solve for:

Hint: Find the smallest integer k such that 2 to the power of k is greater than 15, then multiply by 2.

The full worked solution stays in the interactive walkthrough.

References

Sources

  1. Quantum Computation and Quantum Information by Michael A. Nielsen and Isaac L. Chuang
  2. Wikipedia: Shor's algorithm
  3. Shor, P. W. (1994). Algorithms for quantum computation: discrete logarithms and factoring.
  4. Nielsen, M. A., & Chuang, I. L. (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press.
  5. Shor, P. W. (1994). Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer.
  6. University Quantum Computing — Algorithms