Maths WorkshopMaths problems with full solutions
Exercise 1806Combinatorics › Pigeonhole principleOlympiadAdded 3 Nov 2026

Coloring integers

#pigeonhole#coloring#multiples

Statement

Show that if integers are colored with kk colors, some color class contains two integers whose difference is divisible by kk.

Hint

Residues mod kk.

Show solutionHide solution

Solution

Residues. There are kk residues mod kk, and kk colors. If each color contains at most one residue, we can assign one residue to each color — possible only if there are exactly kk integers.

For k+1k+1 integers. By pigeonhole, two have the same residue mod kk, i.e. their difference is divisible by kk.

Conclusion. With more than kk integers, two same-color integers have difference divisible by kk.