Quantum modular exponentiation (source code)

= Quantum modular exponentiation

Quantum modular exponentiation is the <reversible computation> that maps
$$
|x\rangle|0\rangle\longmapsto|x\rangle|a^x\bmod N\rangle.
$$
It can be implemented in <polynomial time> in the bit lengths of $x$ and $N$ by <repeated squaring> and controlled modular multiplication.