Modular arithmetic has nearly the same arithmetic rules as regular integers with some slight differences. As a result addition and multiplication are straight forward. Subtraction is different in that it will always result in a positive number.
The modulo of a negative number will always result in a positive number. For example since . Another example is since .
- What is Modular Arithmetic?
- Basic Operations
- Multiplicative Inverse
- Fermat’s Little Theorem
- Euler’s Totient Function
- Elementary Number Theory by James K. Strayer
- Data Abstraction and Problem Solving with C++, Walls and mirrors by Frank M. Carrano