Modular Arithmetic
Notation
Meaning
m∣n
m divides n
m∤n
m does not divide n
n≡r(modm)
m∣(n−r), that is, as m divides n−r, n and r have the same remainder when divided by m
⌊x⌋
floor function: largest integer not larger than x
nmodm
(binary operator) remainder of n when divided by m (m is called the modulus, which we assume here to be a positive integer). Equal to n−m⌊mn⌋. Note that 0≤r<m. In C, Python, Java, and pari-gp, it can be computed using using the % binary operator (applied to unsigned integers).
gcd(a,b)
gratest common divisor of a and b.
lcm(a,b)
least common multiple of a and b; equal to ab/gcd(a,b).
Zm
set of equivalence classes modulo m; slightly abusing the mathematical notation for equivalence classes, Zm={0,1,...,m−1}.
Examples


Last updated