Enrichment · STEM Explorations · Math
Choose an operation and type the numbers, as large as you like. The calculator gives the exact remainder and shows the method: the squaring table for powers and the Euclidean algorithm for inverses, the arithmetic behind check digits and internet encryption.
The worked example: 7 to the 45th power, mod 13. Nothing you type leaves this browser.
Loading the calculator. If nothing appears, turn on JavaScript.
Whole numbers only, as long as you like (up to 300 digits). b is used by power, add, subtract and multiply.
Enrichment · STEM ExplorationsFree
Square and multiply; divide and back-substitute.
Write the exponent in binary. Square the base again and again, reducing mod m after each step so the numbers stay small, and multiply together the squares that line up with the 1 bits. A 300-digit exponent needs about a thousand squarings rather than an impossible number of multiplications, which is how encryption software does it.
An inverse of a mod m is a number x with a × x leaving remainder 1. It exists only when a and m share no factor. The Euclidean algorithm divides repeatedly to find the gcd, and tracking the coefficients along the way, the extended algorithm, produces x. When the gcd is not 1, the page says no inverse exists.
The worked example is for practice. Your entries stay in this browser. Support: team@caveatacademic.com.