Problem

Source: 2017 Iran MO 3rd round, first combinatorics exam P1

Tags: Iran, combinatorics



There's a tape with $n^2$ cells labeled by $1,2,\ldots,n^2$. Suppose that $x,y$ are two distinct positive integers less than or equal to $n$. We want to color the cells of the tape such that any two cells with label difference of $x$ or $y$ have different colors. Find the minimum number of colors needed to do so.