Modular Adder background cover

Modular Adder

In this challenge, you have to build a modular adder, key part of Shor's algorithm. This is done with the help of Qualtran.

Alice & Bob

Hosted by

Alice & Bob

Start

Close

Alice-Bob Modular Adder

Modular addition is fundamental to quantum algorithms like Shor's factorization. Optimize a quantum circuit for computing (a + b) mod N using Alice-Bob's cat-qubit architecture.


🎯 Competition Challenge

Design and implement an efficient quantum circuit that performs modular addition (a + b) mod N optimized for Alice-Bob's cat-qubit hardware. Your solution will be evaluated on correctness, circuit depth, gate count, and qubit efficiency.

I. Introduction and Motivation

Modular arithmetic is a cornerstone of quantum computing, powering critical algorithms including:
  • Shor's Algorithm: Integer factorization for cryptography
  • Quantum Phase Estimation: Foundation for many quantum algorithms
  • Quantum Cryptography: Secure communication protocols
The Challenge: Classical modular addition is straightforward, but implementing it efficiently on quantum hardware requires careful circuit design. Alice-Bob's cat-qubits offer unique advantages through bias-preserving gates and exponential error suppression, enabling more efficient implementations.
Your Task: Build a quantum modular adder that leverages these hardware advantages to minimize resource usage while maintaining correctness.

II. The Core Challenge

Task: Implement Quantum Modular Addition

Create a quantum circuit that computes (a + b) mod N for arbitrary inputs.
Goal: Minimize circuit resources (depth, gates, qubits) while achieving 100% correctness.
Steps:
  1. Download the Challenge: Click the "Download" button on this page to set up your local environment using the Aqora CLI
  2. Implement Your Circuit: Design your modular adder using the provided template:
    def modular_adder(a: int, b: int, N: int, n_bits: int) -> QuantumCircuit:
        """
        Implements quantum modular addition: (a + b) mod N
        
        Args:
            a: First operand (0 ≤ a < N)
            b: Second operand (0 ≤ b < N)  
            N: Modulus (2 ≤ N < 2^n)
            n_bits: Number of bits for representation
            
        Returns:
            QuantumCircuit: Circuit computing (a + b) mod N
        """
        # Your implementation here
        pass
  3. Optimize for Alice-Bob: Leverage cat-qubit properties:
    • Bias-preserving gates for reduced errors
    • Hardware-native operations for efficiency
    • Symmetries to reduce qubit count
  4. Test Locally: Validate against test cases (n = 3 to 10 bits)
  5. Submit: Upload your solution via the Aqora platform for automated grading
Deliverable: Python implementation passing all test cases with optimal resource usage.

Automated Grading: All submissions are evaluated automatically by the Aqora platform. Results and detailed feedback are available immediately after submission.

Getting Started

  • Use the "Download" button above to set up your environment with the Aqora CLI
  • All starter code, examples, and documentation are included in the download