Introduction to Quantum Computing
Modular Arithmetic
"Modular arithmetic is a system where numbers 'wrap around' when reaching a certain value called the modulus."
An example of using modular arithmetic is a determining time with a 12-hour clock. The day is composed of two 12-hour periods. If the time is 9:00 now, then in 4 hours it will be 1:00. Notice that addition would result in 9 + 4 = 13. However, the clock 'wrapped around' at 12. The hour number starts over once it passed 12. So, this is modulo 12.
For the modular arithmetic, the formula is -- x mod y = r The number 'r' is the remainder of the division; 'x' is the dividend; 'y' is the divisor. So for the example, x 13 (e.g. what time will it be in 4 hours if it is now 9 -- 9+4=13) and y is 12 the formula is 13 mod(12) = r.
The steps to answer this arithmetic problem are:
- Start by choosing an initial number
- in this example, it is 13 - this is the dividend
- Choose the divisor
- in this example it is 12 - this is the divisor
- Divide the number and round down - 13/12 = 1 - this is the quotient
- Multiply the divisor by the quotient - 12 * 1 = 12
- Subtract this number from the dividend - 13 - 12 = 1.
This number is the result of the modulo operation. Write it as 13 mod 12 = 1.
References:
- Modulo Calculator:
https://www.omnicalculator.com/math/modulo#what-are-modulo-operations
https://www.wolframalpha.com/widgets/view.jsp?id=570e7445d8bdb334c7128de82b81fc13 - Modular Arithmetic:
https://en.wikipedia.org/wiki/Modular_arithmetic - Shor's Algorithm:
https://en.wikipedia.org/wiki/Shor%27s_algorithm - Qiskit:
https://qiskit.org
https://qiskit.org/documentation/stubs/qiskit.algorithms.Shor.html - Basic Qiskit Syntax:
https://qiskit.org/textbook/ch-appendix/qiskit.html - Learn in Qiskit:
https://qiskit.org/learn/ - Qiskit Documentation:
https://qiskit.org/documentation/index.html