Modular Arithmetic
Modular add, multiply, inverse, division, and powers with BigInt.
About this tool
Select an operation; only its required fields are shown. Signed decimal and 0x/0b/0o integers are exact, with no blank-to-zero coercion. The modulus must be positive; modulo 1 all residues and powers are 0. An inverse or division requires gcd(b,m)=1; negative powers require an invertible base.
gcd and lcm are nonnegative, gcd(0,0)=0 and lcm with zero is 0. Bézout gives nonnegative gcd and coefficients for the original signed values. CRT is independent of the other fields; use decimal residue/modulus pairs, with compatible non-coprime moduli allowed.
Limits: 512 characters per arithmetic integer; CRT 128 pairs/4096 digits per integer/65,536 characters.
Arithmetic and small CRT systems update directly; Enter updates immediately (Ctrl/⌘+Enter in the system editor). Larger CRT systems require Calculate and can be cancelled between pair merges; progress counts merged pairs, not CPU time. Only raw inputs and the selected operation are kept locally, including invalid drafts and long systems. Results are recalculated. Copy exports the complete exact answer; long equations scroll locally.