Let $\mathbb{N}$ be the set of positive integers. Find all functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that:

$$
n+f(m) \text { divides } f(n)+n f(m)
$$
The striking thing about this problem is that the relation concerns divisibility rather than equality. How can we exploit this? We are given that $n+f(m) \mid f(n)+n f(m)$ but we can certainly add or subtract multiples of the left hand side from the right hand side and preserve the divisibility. This leads to a key idea:
'Eliminate one of the variables from the right hand side.'
Clearly $n+f(m) \mid f(n)+n f(m)-n(n+f(m))$ so for any $n, m$ we have

$$
n+f(m) \mid f(n)-n^{2}
$$

This feels like a strong condition: if we fix $n$ and let $f(m)$ go to infinity, then $f(n)-n^{2}$ will have arbitrarily large factors, which implies it must be zero.

We must be careful: this argument is fine, so long as the function $f$ takes arbitrarily large values. (We also need to check that $f(n)=n^{2}$ satisfies the original statement which it does.)

We are left with the case where $f$ takes only finitely many values.
In this case $f$ must take the same value infinitely often, so it is natural to focus on an infinite set $S \subset \mathbb{N}$ such that $f(s)=k$ for all $s \in S$. If $n, m \in S$ then the original statement gives $n+k \mid k+n k$ where $k$ is fixed and $n$ can be as large as we like.

Now we recycle our key idea and eliminate $n$ from the right.
$n+k \mid k+n k-k(n+k)$ so $n+k \mid k-k^{2}$ for arbitrarily large $n$. This means that $k-k^{2}=0$ so $k=1$, since it must be positive.

At this point we suspect that $f(n)=1$ for all $n$ is the only bounded solution, so we pick some $t$ such that $f(t)=L>1$ and try to get a contradiction.

In the original statement we can set $m=t$ and get $n+L \mid f(n)+n L$. Eliminating $L$ from the right gives us nothing new, so how can we proceed? Well, we have an infinite set $S$ such that $f$ is constantly 1 on $S$ so we can take $n \in S$ to obtain $n+L \mid 1+n L$

Using our key idea one more time and eliminating $n$ from the right, we get $n+L \mid 1-L^{2}$ for arbitrarily large $n$ which is impossible if $L>1$.

A rather different solution can be found by playing around with small values of $m$ and $n$.
As before it helps to establish $(\star)$ but now $(n, m)=(1,1)$ gives $1+f(1) \mid f(1)-1$.
The left is bigger than the right, so the right must be zero $-f(1)=1$.
Now try $(n, m)=(2,1)$ and obtain $2+f(2) \mid f(2)-4$. Subtracting the left from the right gives $2+f(2) \mid-6$. Since $f(2) \in \mathbb{N}$ the left is a factor of -6 which is bigger than 2 . This gives $f(2)=1$ or $f(2)=4$.

In the first case we can plug this back into the original statement to get $2+f(m) \mid 1+2 f(m)$. Now taking two copies of the left away from the right we have $2+f(m) \mid-3$.

Thus $2+f(m)$ must a factor of -3 which is bigger than 2 , so $f(m)=1$ for any $m$.
Before proceeding with the case $f(2)=4$ we take another look at our strong result $(\star)$. Setting $n=m$ gives $n+f(n) \mid f(n)-n^{2}$ so taking $f(n)-n^{2}$ away from $n+f(n)$ shows that

$$
n+f(n) \mid n+n^{2}
$$

Let see if we can use $(\star)$ and $(\dagger)$ to pin down the value of $f(3)$, using $f(2)=4$.
From $(\star)$ we have $3+4 \mid f(3)-9$ and from $(\dagger)$ we have $3+f(3) \mid 12$. The second of these shows $f(3)$ is 1,3 or 9 , but 1 and 3 are too small to work in the first relation.

Similarly, setting $(n, m)=(4,3)$ in $(\star)$ gives $4+9 \mid f(4)-16$ while $n=4$ in $(\dagger)$ gives $4+f(4) \mid 20$. The latter shows $f(4) \leq 16$ so $13 \mid 16-f(4)$. The only possible multiples of 13 are 0 and 13 , of which only the first one works. Thus $f(4)=16$.

Now we are ready to try induction. Assume $f(n-1)=(n-1)^{2}$ and use $(\star)$ and $(\dagger)$ to obtain $n+(n-1)^{2} \mid f(n)-n^{2}$ and $n+f(n) \mid n+n^{2}$. The latter implies $f(n) \leq n^{2}$ so the former becomes $n^{2}-n+1 \mid n^{2}-f(n)$. If $f(n) \neq n^{2}$ then $n^{2}-f(n)=1 \times\left(n^{2}-n+1\right)$ since any other multiple would be too large. However, putting $f(n)=n-1$ into $n+f(n) \mid n+n^{2}$ implies $2 n-1 \mid n(1+n)$. This is a contradiction since $2 n-1$ is coprime to $n$ and clearly cannot divide $1+n$.

for all $m, n \in \mathbb{N}$.