Quantum Circuits
Division and multiplication by 2 and comparing two numbers to see whether A>B is greater are very easy to do. Addition and subtraction are slightly harder but still simple. Squaring is manageable. The hardest one of all is A modulus B. It is not conceptually hard but it requires piecing together all the previous circuits described above.

Subtraction Circuit
This circuit computes the operation A-C'.


Comparison Circuit
This circuit returns 1 if A>B.


Squaring Circuit
This circuit computes A*A.