. Find all increasing functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that

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

for all integers $n$ and $m$.
. First, let us show that for any integer $n$, there exists a factorization $n=r s$ such that $f(n)=r+s$ and $f(2 n)=2 r+s$. To do this, we exploit the functional equation with $m=1$. It provides a quadratic equation in $f(2 n)$ whose discriminant is $\Delta=f(n)^{2}-4 n$. This must be an integer, i.e., there exists an integer $a$ such that $f(n)^{2}-4 n=a^{2}$. We then have $(f(n)+a)(f(n)-a)=4 n$. The two factors must be even, since their product is $4 n$ and their sum is $2 f(n)$. We set $f(n)+a=2 r$ and $f(n)-a=2 s$ for integers $r$ and $s$. We then have $f(n)=r+s$ and $r s=n$. Finally, solving the quadratic equation gives the two solutions $f(2 n)=2 r+s$ or $f(2 n)=2 s+r$, and by swapping the roles of $r$ and $s$ if necessary, we can retain only the first.

Now, let us apply the previous result without reservation. For $n=1$, we necessarily have $r=s=1$, and thus $f(1)=2, f(2)=3$. Also, if $n=p$ is a prime number, we must have $r=1, s=p$ or $r=p, s=1$. In both cases, $f(p)=r+s=p+1$. Now let $n$ be an odd number. According to Bertrand's postulate, there exists a prime number $p$ between $\frac{n}{2}$ and $n$, and from the case we just treated, $f(p)=p+1$. The increasing nature of $f$ then implies $f(n) \geqslant f(p)=p+1 \geqslant \frac{n}{2}+1$. Consider a factorization $n=r s$ for which $f(n)=r+s$. If neither of the divisors $r$ and $s$ is 1, they are both at least 3 (since $n$ is assumed to be odd), hence $f(n)=r+s \leqslant \frac{n}{3}+3$, which contradicts the other estimate as soon as $n>12$. Thus, for any odd number $n>12$, we also have $f(n)=n+1$. The only odd number that escapes the generic methods above is $n=9$, which can be easily handled manually: the two possible factorizations $n=r s$ are $9=9 \times 1$ and $9=3 \times 3$, but in the second case, we would have $f(9)=6$, which contradicts the increasing nature of $f$ given that $f(7)=8$; thus $f(9)=10$. It only remains to treat the case of even numbers. For this, we show that if $f(n)=n+1$, then $f(2 n)=2 n+1$, and the conclusion " $f(n)=n+1$ for all integers $n$ " will follow by immediate induction on the 2-adic valuation of $n$. Suppose then that $f(n)=n+1$ for a fixed integer $n$. According to the first paragraph, we know that there exists a factorization $n=r s$ for which $f(n)=r+s$ and $f(2 n)=2 r+s$. The only possibilities to reconcile $r s=n$ and $r+s=n+1$ are $r=n, s=1$ on the one hand and $r=1, s=n$ on the other. In the first case, $f(n)=2 n+1$ as desired. Suppose then that we are in the second case. Then $f(2 n)=n+2$ and since the number $2 n-1$ is clearly odd, we also have $f(2 n-1)=2 n$. Thus, by increasing nature, $n+2 \geqslant 2 n$, i.e., $n \leqslant 2$. If $n=1$, we observe that $n+2=2 n+1$ and thus we have what we wanted. For $n=2$, this would give $f(4)=4$, and thus the factorization $n=r s$ for $n=4$ would be $4=2 \times 2$. We would then deduce $f(8)=6$, which once again contradicts the increasing nature of $f$ since $f(7)=8$. In summary, the only possible solution to the functional equation is $f(n)=n+1$, and we do not forget to verify at the end that this function indeed works.