Functional equation in natural numbers with divisibility: $f(m) + f(n) + mn \ | \ m^2f(m) + n^2f(n) + f(m)f(n)$

Find all the functions $f : \mathbb{N}^* \to \mathbb{N}^*$ for which, for all $m, n \in \mathbb{N}^*$: $$f(m) + f(n) + mn \ | \ m^2f(m) + n^2f(n) + f(m)f(n)$$

Approach:

For $m = n = 1$, the relation reads: $$2f(1) + 1 \ | \ 2f(1) + f(1)^2$$

But, also: $$2f(1) + 1 \ | \ 2f(1) + 1$$

Therefore: $$2f(1) + 1 \ | \ f(1)^2 - 1$$

But, also: $$2f(1) + 1 \ | \ 4f(1)^2 + 4f(1) + 1$$

We'll get that: $$2f(1) + 1 \ | \ 4f(1) + 5$$

But, also: $$2f(1) + 1 \ | \ 4f(1) + 2$$

So: $$2f(1) + 1 \ | \ 3$$

And the image of $f$ being a subset of $\mathbb{N}^*$, then: $$2f(1) + 1 = 3$$

Therefore: $$f(1) = 1$$

By applying now, $(m, 1)$: $$f(m) + m + 1 \ | \ m^2f(m) + f(m) + 1$$

Therefore: $$f(m) + m + 1 \ | \ m^2f(m) - 1$$

But I don't know actually how to continue from here.


Solution 1:

Note this problem is discussed in an AoPS thread. Their solutions have some inaccuracies and are missing quite a few details, but they do correctly state that $f(m) = m^2$.

First, let

$$g(m, n) = f(m) + f(n) + mn, \; \; h(m, n) = m^2f(m) + n^2f(n) + f(m)f(n) \tag{1}\label{eq1A}$$

so the divisibility requirement becomes $g(m, n) \mid h(m, n)$. You've also already shown that $f(1) = 1$, and then determined for all $m \in \mathbb{N}^{*}$ that

$$g(m, 1) \mid h(m, 1) \; \; \to \; \; f(m) + m + 1 \mid m^2f(m) + f(m) + 1 \tag{2}\label{eq2A}$$

We then have

$$\begin{equation}\begin{aligned} & (m^2 + 1)g(m, 1) - h(m, 1) \\ & = (m^2 + 1)(f(m) + m + 1) - ((m^2 + 1)f(m) + 1) \\ & = (m^2 + 1)(m + 1) - 1 \\ & = m^3 + m^2 + m \\ & \to \; f(m) + m + 1 \mid m(m^2 + m + 1) \end{aligned}\end{equation}\tag{3}\label{eq3A}$$

Next, as suggested on AoPS, set $m = n = p$ for any prime $p$. The divisibility requirement then becomes

$$g(p, p) \mid h(p, p) \; \; \to \; \; 2f(p) + p^2 \mid 2p^2f(p) + (f(p))^2 \tag{4}\label{eq4A}$$

This leads to

$$\begin{equation}\begin{aligned} & (2f(p) + 3p^2)g(p, p) - 4h(p, p) \\ & = (2f(p) + 3p^2)(2f(p) + p^2) - 4((f(p))^2 + 2p^2f(p)) \\ & = 4(f(p))^2 + 2p^2f(p) + 6p^2f(p) + 3p^4 - 4(f(p))^2 - 8p^2f(p) \\ & = 3p^4 \\ & \to \; \; 2f(p) + p^2 \mid 3p^4 \end{aligned}\end{equation}\tag{5}\label{eq5A}$$

Have $p \gt 2$. Note if $p \mid f(p) + p + 1 \; \to \; f(p) \equiv -1 \pmod{p}$, then $2f(p) + p^2 \equiv -2 \pmod{p}$, but that's incompatible with \eqref{eq5A}. Thus, using $m = p$ in \eqref{eq3A} shows $f(p) + p + 1 \mid p^2 + p + 1 \; \to \; f(p) \le p^2$. Since $f(p) \gt 0$, then $p^2 \lt 2f(p) + p^2 \le 3p^2$. Thus, since $p$ is prime, the limited factoring options of the RHS of \eqref{eq5A} leads to

$$2f(p) + p^2 = 3p^2 \; \; \to \; \; f(p) = p^2 \tag{6}\label{eq6A}$$

Next, with any $n \in \mathbb{N}^{*}$, have $m$ be a prime $p \gt \max(n^3, (n + 1)f(n))$. Using \eqref{eq6A}, we then get

$$g(p, n) \mid h(p, n) \; \; \to \; \; p^2 + f(n) + pn \mid p^4 + n^{2}f(n) + p^{2}f(n) \tag{7}\label{eq7A}$$

From this, we have

$$\begin{equation}\begin{aligned} & (n^2 + p^2)g(p, n) - h(p, n) \\ & = (n^2 + p^2)(f(n) + p^2 + pn) - ((n^2 + p^2)f(n) + p^4) \\ & = (n^2 + p^2)(p^2 + pn) - p^4 \\ & = n^2p^2 + n^3p + np^3 \\ & \to \; \; p(p + n) + f(n) \mid np(p^2 + np + n^2) \end{aligned}\end{equation}\tag{8}\label{eq8A}$$

Since $p \gt (n + 1)f(n)$, then $p \not\mid p(p + n) + f(n)$ so \eqref{eq8A} gives that $p(p + n) + f(n) \mid n(p^2 + np + n^2)$. Thus, for some positive integer $k$, we get

$$\begin{equation}\begin{aligned} n(p^2 + np + n^2) & = k(p^2 + pn + f(n)) \\ np^2 + n^2p + n^3 & = kp^2 + kpn + kf(n) \\ n^3 - kf(n) & = (k - n)p^2 + (k - n)pn \\ n^3 - kf(n) & = (k - n)p(p + n) \end{aligned}\end{equation}\tag{9}\label{eq9A}$$

Thus, we have $p \mid n^3 - kf(n)$, but due to the previously specified size constraints on $p$, we have from the first line of \eqref{eq9A} that $k \le n + 1$, which means that $\lvert n^3 - kf(n) \rvert \lt p \; \to \; n^3 - kf(n) = 0$. With this, \eqref{eq9A} gives $k - n = 0 \; \to \; k = n$. Thus, for all $n \in \mathbb{N}^{*}$,

$$n^3 - nf(n) = 0 \; \; \to \; \; f(n) = n^2 \tag{10}\label{eq10A}$$

This shows it's the only possible solution. Also, using this gives

$$h(m, n) = m^4 + n^4 + m^2n^2 = (m^2 + n^2 + mn)(m^2 + n^2 - mn) = g(m, n)(m^2 + n^2 - mn)$$

so the divisibility requirement always holds. This proves $f(n) = n^2$ is the one and only solution.