How find all ordered pairs $(m,n)$ such $\frac{n^3-1}{mn-1}$ is an integer

Note that if $(m, n)$ is a solution then $(mn-1) \mid (n^3-1)$ so $(mn-1) \mid m^3(n^3-1)$. Also $(mn-1)\mid m^3n^3-1$ so $(mn-1) \mid m^3-1$, so $(n, m)$ is also a solution.

We may thus WLOG assume $m \geq n$. If $n=1$ then $\frac{n^3-1}{mn-1}=0$ so $(m, 1)$ is a solution for all positive integers $m>1$. I would reject $(1, 1)$ as that leads to $\frac{0}{0}$.

Otherwise $n \geq 2$. Note that $\frac{n^3-1}{mn-1} \equiv 1 \pmod{n}$ so we may write $\frac{n^3-1}{mn-1}=kn+1$, for some $k \in \mathbb{Z}$.

Now $m, n \in \mathbb{Z}^+$ so $0<\frac{n^3-1}{mn-1}=kn+1$. Since $n \geq 2$, this implies $k \geq 0$.

Since $m \geq n$, we have $kn+1=\frac{n^3-1}{mn-1} \leq \frac{n^3-1}{n^2-1}=\frac{n^2+n+1}{n+1}=n+\frac{1}{n+1}<n+1$. Thus $k<1$.

Therefore $k=0$, so $\frac{n^3-1}{mn-1}=1$, so $n^3-1=mn-1$, so (since $m, n>0$) $m=n^2$.

In conclusion, all positive integer solutions are given by $(m, 1)$ for $m>1$, $(1, n)$ for $n>1$, $(m, m^2)$ for $m>1$, and $(n^2, n)$ for $n>1$.


There are infinitely many solutions. Some examples:

If $m = n^2, n > 1$, then

$$\frac{n^3 - 1}{mn - 1} = \frac{n^3 - 1}{n^3 - 1} = 1 \in \mathbb{Z}$$

If $n = m^2, m>1$, then $$\frac{m^6 - 1}{m^3 - 1} = \frac{(m^3+1)(m^3-1)}{m^3 - 1} = m^3 + 1 \in \mathbb{Z}$$

Of course, these do not necessarily represent all of the solutions.