## Modular Arithmetic Calculator

Welcome to the Modular Arithmetic Calculator, which performs arithmetic modulo an integer (also known as "clock arithmetic"). Modular arithmetic is essential to many aspects of communication in today's world, including:

- Public key cryptography, which keeps your personal information secure when you make purchases over the Web.
- Error-correcting codes, which enable you to make calls on your cell phone despite interference to the call signal.

To use the Modular Arithmetic Calculator, enter a non-zero integer for the modulus m, and integers a and b below. Then press one of the operation buttons. The answer is displayed next to **Result**.

**Notes:**

- 1 / a (the multiplicative inverse of a) exists if and only if the greatest common divisor of a and m is 1. See Greatest Common Divisor.

- Square roots are only calculated when the modulus m is a prime number (using the Tonelli-Shanks algorithm).

- If r is a square root of a, so is m - r. For example, since 3 is a squa;re 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.

There were over 4000 requests for this page in April 2013. Please send any comments or suggestions for improving the Modular Arithmetic Calculator. Paul Trow's math page.

Copyright 2009 by Paul Trow