Math Fundamentals18 sections · 814 units
Open in Course

Common Modulo Patterns

Practical applications

You'll see these patterns repeatedly:

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

∙\bullet Extracting last digit: n mod 10n \bmod 10

∙\bullet Cycling indices: i mod ni \bmod n wraps ii to range [0,n−1][0, n-1]

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

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