Start With Modular Exponentiation
Inspect the reversible arithmetic block used by the circuit.
cargo run --example modular_exponentiation_demo
Educational Shor Walkthrough
This guide explains the small-scale Shor-style factorization path in miniQ. The goal is to show the shape of the algorithm on N = 15, not to provide cryptographic-scale factoring.
The factor-15 path combines a counting register, a work register, modular exponentiation, work-register measurement, inverse QFT, phase-to-period recovery, and classical factor extraction.
Run these examples in order to see the circuit assembled, measured, transformed, and postprocessed.
Inspect the reversible arithmetic block used by the circuit.
cargo run --example modular_exponentiation_demo
See the counting and work registers after modular exponentiation.
cargo run --example shor_order_finding_circuit_15
Measurement collapses the counting register into a periodic pattern tied to the hidden period.
cargo run --example shor_work_measurement_15
Apply inverse QFT, measure the counting register, and try to recover the period with continued fractions.
cargo run --example shor_period_recovery_15
Some measurements are uninformative, so this example repeats the attempt until it finds nontrivial factors or reaches its limit.
cargo run --example shor_factor_15
miniQ uses little-endian register indexing. Displayed bitstrings are MSB-first, so the left side of a printed label corresponds to the highest-index qubits.
This walkthrough runs on a classical state-vector simulator. The memory required by the simulator doubles with every added qubit. RSA-scale Shor factoring would require fault-tolerant quantum hardware, many logical and physical qubits, error correction, and far deeper coherent computation than miniQ can represent.
The factor-15 path is intentionally small-scale and educational.