Shor's Algorithm (Period Count) Calculator
Relationship between period 'r' and the number of qubits 'n' for integer factoring.
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
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?
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
- Quantum Computation and Quantum Information by Michael A. Nielsen and Isaac L. Chuang
- Wikipedia: Shor's algorithm
- Shor, P. W. (1994). Algorithms for quantum computation: discrete logarithms and factoring.
- Nielsen, M. A., & Chuang, I. L. (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press.
- Shor, P. W. (1994). Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer.
- University Quantum Computing — Algorithms