12.10 Shor’s factoring algorithm
Source: Ideas from Computational Physics (Landau, Páez, Bordeianu), §12.10. Original wording — no
Amod15/ Qiskit dump. Continues 12.9b. Labs: 12.10b.
RSA-style cryptology leans on the hardness of factoring large integers. Shor’s algorithm finds nontrivial factors of in (believed) polynomial time on a fault-tolerant quantum computer by reducing factoring to period finding.
Classical outline
- Pick random .
- ; if , is a factor — done.
- Find the smallest period of .
- If is odd or , retry with a new .
- Else yields nontrivial factors.
Example toy: . A successful run might draw , read phase ⇒ , then recover factors 3 and 5.
Modular multiplication unitary
A unitary (for coprime to ) multiplies the computational register by mod . Eigenstates carry eigenvalues ; estimating that phase reveals . Pick and the reading among lookalikes in the guided card below.
Phase estimation
For unitary , a -qubit control register plus Hadamards and controlled- kicks phases onto the controls. An inverse QFT then reads an integer , so .
Period finding → factors
Prepare the target register in . Phase estimation samples ; continued fractions recover denominator . Then apply the gcd steps above.
Local Qiskit sketches combine qpe, a modular-multiply block (e.g. for ), and classical post-processing — APIs change; keep the math, update imports from current docs. Graded labs lock , periods, and the factors without calling IBM.
Lab: wire phase-est skeleton
Takeaway
| Step | Tool |
|---|---|
| Random , gcd | classical |
| Period of | QPE + modular |
| factors | |
| QFT link | inverse QFT inside QPE |
Shor
1 / 3Shor reduces factoring mainly to…
Pick an answer to see if you are right.
Next: 12.10b Shor labs.