The idea
Key formulas
Division with remainder
Congruence
Loading lessons…
Just a moment, getting everything ready. The first load can take up to a minute.
Discrete maths
Modular arithmetic works with remainders; repeated squaring computes large powers exactly, while inverses exist only for coprime inputs.
For positive , the expression is the least nonnegative remainder after dividing by . Two integers are congruent modulo when their difference is divisible by . A modular inverse of is a value with ; it exists exactly when .