Problem (Combinatorics):
Find the smallest positive integer $k$ for which there exist a colouring of the positive integers $\mathbb{Z}_{>0}$ with $k$ colours and a function $f: \mathbb{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ with the following two properties:

(i) For all positive integers $m, n$ of the same colour, $f(m+n)=f(m)+f(n)$.

(ii) There are positive integers $m, n$ such that $f(m+n) \neq f(m)+f(n)$.

In a colouring of $\mathbb{Z}_{>0}$ with $k$ colours, every integer is coloured in exactly one of the $k$ colours. In both (i) and (ii) the positive integers $m, n$ are not necessarily different.

Solution:
The answer is $k=3$.

First we show that there is such a function and coloring for $k=3$. Consider $f: \mathbb{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ given by $f(n)=n$ for all $n \equiv 1$ or 2 modulo 3 , and $f(n)=2 n$ for $n \equiv 0$ modulo 3 . Moreover, give a positive integer $n$ the $i$-th color if $n \equiv i(3)$.

By construction we have $f(1+2)=6 \neq 3=f(1)+f(2)$ and hence $f$ has property (ii).

Now let $n, m$ be positive integers with the same color $i$. If $i=0$, then $n+m$ has color 0 , so $f(n+m)=$ $2(n+m)=2 n+2 m=f(n)+f(m)$. If $i=1$, then $n+m$ has color 2 , so $f(n+m)=n+m=f(n)+f(m)$. Finally, if $i=2$, then $n+m$ has color 1 , so $f(n+m)=n+m=f(n)+f(m)$. Therefore $f$ also satisfies condition (i).

Next we show that there is no such function and coloring for $k=2$.

Consider any coloring of $\mathbb{Z}_{>0}$ with 2 colors and any function $f: \mathbb{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ satisfying conditions (i) and (ii). Then there exist positive integers $m$ and $n$ such that $f(m+n) \neq f(m)+f(n)$. Choose $m$ and $n$ such that their sum is minimal among all such $m, n$ and define $a=m+n$. Then in particular for every $b<a$ we have $f(b)=b f(1)$ and $f(a) \neq a f(1)$.

If $a$ is even, then condition (i) for $m=n=\frac{a}{2}$ implies $f(a)=f\left(\frac{a}{2}\right)+f\left(\frac{a}{2}\right)=f(1) a$, a contradiction. Hence $a$ is odd. We will prove two lemmas.

Lemma 1. Any odd integer $b<a$ has a different color than $a$.

Proof. Suppose that $b<a$ is an odd integer, and that $a$ and $b$ have the same color. Then on the one hand, $f(a+b)=f(a)+b f(1)$. On the other hand, we also have $f(a+b)=f\left(\frac{a+b}{2}\right)+f\left(\frac{a+b}{2}\right)=(a+b) f(1)$, as $\frac{a+b}{2}$ is a positive integer smaller than $a$. Hence $f(a)=f(a+b)-b f(1)=(a+b) f(1)-b f(1)=a f(1)$, which is again a contradiction. Therefore all odd integers smaller than $a$ have a color different from that of $a$.

Lemma 2. Any even integer $b<a$ has the same color as a

Proof. Suppose $b<a$ is an even integer, and that $a$ and $b$ have different colors. Then $a-b$ is an odd integer smaller than $a$, so it has the same color as $b$. Thus $f(a)=f(a-b)+f(b)=(a-b) f(1)+b f(1)=a f(1)$, a contradiction. Hence all even integers smaller than $a$ have the same color as $a$.

Suppose now $a+1$ has the same color as $a$. As $a>1$, we have $\frac{a+1}{2}<a$ and therefore $f(a+1)=2 f\left(\frac{a+1}{2}\right)=$ $(a+1) f(1)$. As $a-1$ is an even integer smaller than $a$, we have by Lemma 2 that $a-1$ also has the same color as $a$. Hence $2 f(a)=f(2 a)=f(a+1)+f(a-1)=(a+1) f(1)+(a-1) f(1)=2 a f(1)$, which implies that $f(a)=a f(1)$, a contradiction. So $a$ and $a+1$ have different colors.

Since $a-2$ is an odd integer smaller than $a$, by Lemma 1 it has a color different from that of $a$, so $a-2$ and $a+1$ have the same color. Also, we have seen by Lemma 2 that $a-1$ and $a$ have the same color. So $f(a)+f(a-1)=f(2 a-1)=f(a+1)+f(a-2)=(a+1) f(1)+(a-2) f(1)=(2 a-1) f(1)$, from which it follows that $f(a)=(2 a-1) f(1)-f(a-1)=(2 a-1) f(1)-(a-1) f(1)=a f(1)$, which contradicts our choice of $a$ and finishes the proof.

We prove that $k \leq 3$ just as in first solution.

Next we show that there is no such function and coloring for $k=2$.

Consider any coloring of $\mathbb{Z}_{>0}$ with 2 colors and any function $f: \mathbb{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ satisfying conditions (i) and (ii). We first notice with $m=n$ that $f(2 n)=2 f(n)$.

Lemma 3. For every $n \in \mathbb{Z}_{>0}, f(3 n)=3 f(n)$ holds.

Proof. Define $c=f(n), d=f(3 n)$. Then we have the relations

$$
f(2 n)=2 c, \quad f(4 n)=4 c, \quad f(6 n)=2 d
$$

- If $n$ and $2 n$ have the same color, then $f(3 n)=f(n)+f(2 n)=3 c=3 f(n)$.
- If $n$ and $3 n$ have the same color, then $4 c=f(4 n)=f(n)+f(3 n)=c+f(3 n)$, so $f(3 n)=3 f(n)$.
- If $2 n$ and $4 n$ have the same color, then $2 d=f(6 n)=f(2 n)+f(4 n)=2 c+4 c=6 c$, so $f(3 n)=d=3 c$.
- Otherwise $n$ and $4 n$ have the same color, and $2 n$ and $3 n$ both have the opposite color to $n$. Therefore we compute $5 c=f(n)+f(4 n)=f(5 n)=f(2 n)+f(3 n)=2 c+f(3 n)$ so $f(3 n)=3 f(n)$.

Consequently, for $k=2$ we necessarily have $f(3 n)=3 f(n)$.

Now let $a$ be the smallest integer such that $f(a) \neq a f(1)$. In particular $a$ is odd and $a>3$. Consider the three integers $a, \frac{a-3}{2}, \frac{a+3}{2}$. By pigeonhole principle two of them have the same color.

- If $\frac{a-3}{2}$ and $\frac{a+3}{2}$ have the same color, then $f(a)=\frac{a-3}{2} f(1)+\frac{a+3}{2} f(1)=a f(1)$.
- If $a$ and $\frac{a-3}{2}$ have the same color, then $3 \frac{a-1}{2} f(1)=3 f\left(\frac{a-1}{2}\right)=f\left(\frac{3 a-3}{2}\right)=f(a)+f\left(\frac{a-3}{2}\right)=f(a)+$ $\frac{a-3}{2} f(1)$, so $f(a)=a f(1)$.
- If $a$ and $\frac{a+3}{2}$ have the same color, then $3 \frac{a+1}{2} f(1)=3 f\left(\frac{a+1}{2}\right)=f\left(\frac{3 a+3}{2}\right)=f(a)+f\left(\frac{a+3}{2}\right)=f(a)+$ $\frac{a+3}{2} f(1)$, so $f(a)=a f(1)$.

In the three cases we find a contradiction with $f(a) \neq a f(1)$, so it finishes the proof.

As before we prove that $k \leq 3$ and for any such function and colouring we have $f(2 n)=2 f(n)$.

Now we show that there is no such function and coloring for $k=2$.

Consider any coloring of $\mathbb{Z}_{>0}$ with 2 colors and any function $f: \mathbb{Z}_{>0} \rightarrow \mathbb{Z}_{>0}$ satisfying conditions (i) and (ii). Say the two colors are white (W) and black (B). Pick $m, n$ any two integers such that $f(m+n)=f(m)+f(n)$. Without loss of generality we may assume that $m+n, m$ are black and $n$ is white.

Lemma 4. For all $l \in \mathbb{Z}_{>0}$ and every $x$ whose color is black, we have $x+l m$ is black and $f(x+\operatorname{lm})=$ $f(x)+l f(m)$.

Proof. We proceed by induction. It is clearly true for $l=0$. If $x+l m$ is black and satisfies $f(x+l m)=$ $f(x)+l f(m)$, then $f(x+(l+1) m)=f(x+l m)+f(m)=f(x)+(l+1) f(m)$ and $f(x+(l+1) m+n)=$ $f(x+l m)+f(m+n)=f(x)+l f(m)+f(m+n) \neq f(x)+(l+1) f(m)+f(n)=f(x+(l+1) m)+f(n)$, so $x+(l+1) m$ is not the same color of $n$, therefore $x+(l+1) m$ is black. Thjs completes the induction.

In particular we then must have that $2^{l} n$ is white for every $l$, because otherwise since $2^{l} m$ is black we would have $2^{l} f(m+n)=f\left(2^{l} m+2^{l} n\right)=f\left(2^{l} m\right)+f\left(2^{l} n\right)=2^{l}(f(m)+f(n))$, and consequently $f(m+n)=$ $f(m)+f(n)$.

Lemma 5. For every $l \geq 1,2^{l} m+2^{l-1} n$ is black.



Proof. On the one hand we have $2^{l} f(m+n)=f\left(2^{l} m+2^{l} n\right)=f\left(2^{l-1}(2 m+n)+2^{l-1} n\right)$. On the other hand we have

$\left.2^{l} f(m+n)=2^{l-1} \cdot 2 f(m+n) \neq 2^{l-1}(f(m+n)+f(m)+f(n))=2^{l-1}(f(2 m+n)+f(n))=f\left(2^{l} m+2^{l-1} n\right)\right)+f\left(2^{l-1} n\right)$.

Therefore $2^{l} m+2^{l-1} n$ and $2^{l-1} n$ have different color, which means $2^{l} m+2^{l-1} n$ is black.

Combining the two lemmas give $j m+2^{l-1} n$ is black for all $j \geq 2^{l}$ and every $l \geq 1$.

Now write $m=2^{l-1} m^{\prime}$ with $m^{\prime}$ odd. Let $t$ be a number such that $\frac{2^{t}-1}{m^{\prime}}$ is an integer and $j=\frac{2^{t}-1}{m^{\prime}} n \geq 2^{l}$, i.e. $t$ is some multiple of $\phi\left(m^{\prime}\right)$. Then we must have that $j m+2^{l-1} n$ is black, but by definition $j m+2^{l-1} n=$ $\left(2^{t}-1\right) 2^{l-1} n+2^{l-1} n=2^{t+l-1} n$ is white. This is a contradiction, so $k=2$ is impossible.

Final answer: $k=3$