Clock arithmetic · exact BigInt
🕰️ Modular Arithmetic
Type a and n to get a mod n the mathematician's way — negative numbers land in 0…n−1, unlike the % operator in JS, Go or C. Exact BigInt for huge numbers: modular add, subtract, multiply, fast power a^e mod n, gcd and the modular inverse via extended Euclid — all visualised on a clock dial.
mod
=
5
b =
e =
fast power
Modular arithmetic is everywhere: clock hours (mod 12), weekdays (mod 7), the last digit (mod 10), checksums on ID numbers, hash tables, and RSA encryption — whose whole trick is that a^e mod n is easy but undoing it is hard. The inverse a⁻¹ exists only when gcd(a, n) = 1.