A quadratic Diophantine equation involving $3n^2-n$ I got this question from a colleague who likes to solve Diophantine equations.
Find integer solution(s) for
$\qquad\dfrac{m}{n}+ \dfrac{n+1}{m}=4$
Clearly $\space\space  m=-4 \space\space $
and
$\space\space  n=-1\space\space  $ is a solution, but we are wondering whether there are others.
What we have tried is that we got
$\space \space m^2-4mn+n^2+n=0\space \space $
and thus it must be the case that
$\space \space 3n^2-n\space \space $ is a perfect square. Then we are a bit stuck.
 A: $3n^2 - n - k^2 = 0 \implies \triangle = 1+12k^2 = m^2 \implies m^2 - 3(2k)^2 = 1$. This Diophantine equation is known to have infinite solutions: with the initial one is $(m,k) = (7,2)$, and the next ones are : $(2m+6k,m+4k)$.
A: Some algebraic manipulation shows that your equation, for $m,n\neq0$, is equivalent to
$$(6n-1)^2-3(2m-4n)^2=1.\tag{1}$$
This is a Pell equation; setting $X:=6n-1$ and $Y:=2m-4n$ this is simply
$$X^2-3Y^2=1.$$
Its integral solutions are well known; they are precisely the pairs of integers $(X_k,Y_k)$ of the form
$$X_k+Y_k\sqrt{3}=\pm(2+\sqrt{3})^k,\tag{2}$$
for some integer $k$. We get a corresponding solution to $(1)$ if and only if $X_k\equiv5\pmod{6}$ and $Y_k\equiv0\pmod{2}$. This happens precisely when $k$ is even and we have the $-$-sign in $(2)$. So the solutions to your equation are precisely the pairs $(m,n)$ of the form
$$m=\frac{3Y_l+2X_l+2}{6}\qquad\text{ and }\qquad n=\frac{X_l+1}{6},$$
where $X_l$ and $Y_l$ are the integers defined by
$$X_l+Y_l\sqrt{3}=-(7+4\sqrt{3})^l.$$
For a few small values this yields the following solutions $(m,n)$:
$$\begin{array}{r|rr}
l&m&n&\\
\hline
-3&-60&-225\\
-2&-4&-16\\
-1&0&-1\\
0&0&0\\
1&-4&-1\\
2&-60&-16\\
3&-840&-225\\
\end{array}$$
Note that $l=-1$ and $l=0$ yields solutions to $(1)$, but not to the original equation.
