Math Fundamentals18 sections · 814 units
Open in Course

Common Modulo Patterns

Practical applications

You'll see these patterns repeatedly:

\bullet Checking divisibility: amodb=0a \bmod b = 0 means bb divides aa

\bullet Extracting last digit: nmod10n \bmod 10

\bullet Cycling indices: imodni \bmod n wraps ii to range [0,n1][0, n-1]

\bullet Preventing overflow: apply modulo at each step in calculations

\bullet Hash functions: hash(x)=xmodm\text{hash}(x) = x \bmod m distributes values into mm buckets