Welcome to the Modular Arithmetic Calculator, which performs arithmetic modulo an integer (called the *modulus*).

To use the calculator, enter a non-zero integer for the modulus, and integers a and b below. Then press one of the operation buttons to get the result.

**Notes:**

- 1 / a (the multiplicative inverse of a) exists if and only if the greatest common divisor of a and the modulus is 1.
- Square roots are only calculated when the modulus is a prime number (using the Tonelli-Shanks algorithm).
- If r is a square root of a, so is m - r (where m is the modulus). For example, since 3 is a square root of 9 modulo 17, the other square root of 9 is 14 (= 17 - 3). After calculating a square root, click
**+/- Result**to get the other root.

Copyright 2009 by Paul Trow