Groups
Category
Level
The floor sum computes S(n,m,a,b) = sum_{i=0}^{n-1} floor((a i + b)/m) efficiently in O(log(min(a,m))) time.
The greatest common divisor (gcd) of two integers is the largest integer that divides both without a remainder.
Pick's Theorem connects area and lattice-point counts for any simple polygon with integer-coordinate vertices.