[Paper Review] Factoring using 2n+2 qubits with Toffoli based modular multiplication
This paper presents a space-optimized implementation of Shor’s algorithm using only 2n+2 qubits, leveraging a Toffoli-based in-place constant-adder circuit with dirty ancilla qubits. The approach achieves O(n³ log n) gate count and O(n³) circuit depth, matching prior space-efficient designs while eliminating costly rotation synthesis and enabling efficient classical simulation and hardware debugging via reversible circuit techniques.
We describe an implementation of Shor's quantum algorithm to factor n-bit integers using only 2n+2 qubits. In contrast to previous space-optimized implementations, ours features a purely Toffoli based modular multiplication circuit. The circuit depth and the overall gate count are in O(n^3) and O(n^3 log(n)), respectively. We thus achieve the same space and time costs as Takahashi et al., while using a purely classical modular multiplication circuit. As a consequence, our approach evades most of the cost overheads originating from rotation synthesis and enables testing and localization of faults in both, the logical level circuit and an actual quantum hardware implementation. Our new (in-place) constant-adder, which is used to construct the modular multiplication circuit, uses only dirty ancilla qubits and features a circuit size and depth in O(n log(n)) and O(n), respectively.
Motivation & Objective
- To implement Shor’s algorithm using only 2n+2 qubits, minimizing qubit overhead while maintaining practical scalability.
- To replace rotation-based arithmetic (e.g., QFT) with classically inspired, reversible Toffoli networks to avoid rotation synthesis overhead.
- To enable efficient classical simulation and hardware-level debugging of quantum circuits by using dirty ancilla qubits and reversible logic.
- To achieve a constant-adder circuit with O(n log n) size and O(n) depth using only 1 to n dirty ancilla qubits, avoiding clean ancilla requirements.
- To demonstrate that Toffoli-based arithmetic enables better asymptotic scaling in gate count and depth when combined with quantum error correction.
Proposed method
- Design a Toffoli-based in-place constant-adder that adds a classical n-bit constant to a quantum n-qubit register using only dirty ancilla qubits.
- Use the constant-adder as the core building block for a Toffoli-only modular multiplication circuit, replacing controlled rotation gates.
- Construct the modular exponentiation step in Shor’s algorithm using repeated modular multiplications via the Toffoli-based adder.
- Utilize dirty ancilla qubits that are borrowed during computation and returned to their original state, enabling space efficiency without requiring clean initialization.
- Ensure the circuit remains fully reversible and classically simulatable by avoiding superposition states in intermediate steps.
- Apply binary search-based fault localization on physical hardware by testing basis state inputs and comparing outputs to simulated ideal results.
Experimental results
Research questions
- RQ1Can Shor’s algorithm be implemented with only 2n+2 qubits using a purely Toffoli-based arithmetic circuit?
- RQ2Does using dirty ancilla qubits in a Toffoli network reduce the need for expensive single-qubit rotation synthesis under quantum error correction?
- RQ3Can classical reversible simulators effectively test and debug Toffoli-based quantum circuits at scale?
- RQ4Is it possible to achieve O(n³ log n) gate count and O(n³) depth with a Toffoli-only circuit while maintaining correctness and space efficiency?
- RQ5Can fault localization in physical implementations be efficiently performed using basis state testing and recursive binary search on Toffoli networks?
Key findings
- The proposed Toffoli-based constant-adder achieves O(n log n) circuit size and O(n) depth using only 1 to n dirty ancilla qubits, enabling space-efficient arithmetic.
- The modular multiplication circuit is constructed entirely from Toffoli and Clifford gates, avoiding controlled rotation gates and their associated synthesis overhead.
- The overall circuit size is O(n³ log n) and depth is O(n³), matching the best-known space-optimized implementations in terms of resource scaling.
- The use of Toffoli-based circuits enables full classical simulation of logical circuits and efficient hardware-level debugging via basis state testing and fault localization.
- The approach avoids the Θ(n⁴) gate count of exact QFT-based implementations and the Θ(n³ log²n) cost of prior Toffoli-based designs, achieving optimal asymptotic scaling.
- The method enables practical testing and verification of quantum circuits on classical hardware, which is not feasible for superposition-heavy circuits like QFT-based adders.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.