Partition the integers into three subsets such that for any $n$, the three integers $n, n+p$ and $n+q$ belong to different subsets Question from Engel's book problem solving strategies.
Let $p$ and $q$ be fixed integers. The set of integers are to be partitioned into three subsets $A,B,C$ such that for any $n \in \mathbb{Z}$, the three integers $n, n+p$ and $n+q$ belong to different subsets. What conditions must $p$ and $q$ satisfy?
I have hardly any idea how to do this question.
Maybe can see it as a graph, and each vertex is a number, and from vertex $n$, there is an edge going to vertices $n-p, n-q, n+p, n+q$, and we are looking for a 3-coloring?
A easy case is if the pattern is somehow regular, like $p=2,q=4$, then we can partition as $\{0,1,6,7 \dots\}, \{2,3,8,9,\dots\},\{4,5,10,11\dots\}$
 A: We approach this from the perspective of colouring the graph $Z$ where each vertex represents an integer, the colours correspond to the desired partitions and $n,n+p,n+q$ are given different colours.
If $\gcd(p,q)=d>1$, $Z$ is the disjoint union of $d$ copies of itself. Hence we may assume $\gcd(p,q)=1$, in which case $Z$ is a triangular lattice as shown below. There is only one way to 3-colour this lattice up to colours, which assigns the same colour to all points $n+mp+nq$ with $m\equiv n\bmod3$.

Some numbers are repeated in this lattice, however. To obtain a line of integers we must project the lattice onto a line, i.e. define some relation $ap+bq=0$ with $\gcd(a,b)=1$. This projection must not conflict with the 3-colouring, which implies that $a,b$ satisfy the same relation as $m,n$ above: $a\equiv b\bmod3$. Taking $ap+bq=0$ modulo $3$ we then see that $a(p+q)\equiv0\bmod3$ where $a\not\equiv0\bmod3$ (otherwise $\gcd(a,b)$ would not be $1$), implying $p+q\equiv0\bmod3$.
Combining this last relation with $\gcd(p,q)=1$, we see in the general case that for the pair $(p,q)$ to define an admissible partition, it must be of the form $(dp',dq')$, where $\gcd(p,q)=d$, one of $p'$ and $q'$ is $1\bmod3$ and the other is $2\bmod3$.
