TITLE: Find $m\in\mathbb N$, $n\in\mathbb N$, and $f(0)$ where $f(x)=ax^3+bx^2+cx+d$ $(a,b,c,d\in\mathbb Z)$, $f(mn)=1$, $f(m)=n^2$, $f(n)=m^2$, ...
QUESTION [8 upvotes]: Question: Find $m\in\mathbb N$, $n\in\mathbb N$, and $f(0)$ where ($m,n\gt 1$)

$f(x)=ax^3+bx^2+cx+d$ $(a,b,c,d\in\mathbb Z)$
$f(mn)=1$
$f(m)=n^2$
$f(n)=m^2$
$f(1)=m^2n^2$


What I tried so far was:
\begin{align}
&f(mn)-f(1)=(mn-1)\left(a(m^2n^2+mn+1)+b(mn+1)+c\right)=(mn-1)(mn+1)\\
&\therefore a(m^2n^2+mn+1)+(b-1)(mn+1)+c=0\tag1\\
&f(m)-f(n)=(m-n)\left(a(m^2+mn+n^2)+b(m+n)+c\right)=(m-n)(m+n)\\
&\therefore m=n,\quad\text{or}\quad a(m^2+mn+n^2)+(b-1)(m+n)+c=0\tag2\\
&\\
&m\ne n:\\
&(1)-(2)\Rightarrow (m-1)(n-1)\left(a(m+1)(n+1)+(b-1)\right)=0\\
&b-1=-a(m+1)(n+1)\\
&(2)\rightarrow c=-a(m^2+mn+n^2)+a(m+1)(n+1)(m+n)\\
&d=m^2n^2-a-b-c=mn(mn-a(m+n))-1\\
&f(x)=ax^3-a(m+1)(n+1)x^2+x^2-a(m^2+mn+n^2)x+a(m+1)(n+1)(m+n)x+mn(mn-a(m+n))-1\\
&
\end{align}
And then I gave up...

REPLY [2 votes]: By 2., we can use the Factor Theorem to write
$$
f(x)-1=q(x)(x-mn)
$$
for polynomial $q$ with integer coefficients (and degree at most $2$, though that doesn't directly figure into this proof).
From 3. it follows that
$$
n^2-1=q(m)(m-mn)
$$
and so (since $n>1$)
$$
q(m)=\frac{n^2-1}{m-mn}=-\frac{n+1}{m}
$$
Similarly,
$$
q(n)=-\frac{m+1}{n}
$$
But $q$ has integer coefficients, which means it takes on integer values at integer arguments. So $n+1$ is a multiple of $m$ and $m+1$ is a multiple of $n$.
Without loss of generality, suppose $n \geq m$. Since $n > 1$ and $m+1$ is a multiple of $n$, we must have $n=m+1$. But then $m+2$ is a multiple of $m$. As $m > 1$, this implies that $m=2$ (and hence $n=3$).
So the conditions reduce to
$$
f(6)=1\\
f(3)=4\\
f(2)=9\\
f(1)=36
$$
from which it follows by Lagrange interpolation that
$$
f(x)
=−2x^3+23x^2−82x+97
$$
So $f(0)=97$.