# Find all integers $n$ such that $\frac{(n^2-n-1)^2}{2n-1}$ is a positive integer

My task is to find all integers $n$ such that $\frac{(n^2-n-1)^2}{2n-1}$ is a positive integer, and if possible a general technique for solving questions of this type of rational functions. My first step in finding solutions was I showed that both numerator and denominator must be odd (using modular arithmetic base $2$) and thus if $d(2n-1)=(n^2-n-1)^2$, then $d$ must be odd. First considering the case of $2n-1$ equaling $n^2-n-1$ and thus $n$ must equal $0$ or $3$ (so two solutions). Next considering $2n-1$ equaling $(n^2-n-1)^2$ and the only integer solution to this is $n=1$ (third solution). I've now stumbled on how to check for further solutions, and am seeking hints/methods/solutions to finding the other potential solutions. Thank you.

• If $n\le 0$, then the fraction is negative, so not a positive integer. That eliminates half of possible $n$ for you. :-) – vadim123 Mar 22 '18 at 22:43
• If $p|(n^2-n-1)$ and $p|(2n-1)$ then $p|(n^2+n)$. If also $p$ does not divide $n$ then $p|(3n)$ so $p|3$ ??? – Malcolm Mar 22 '18 at 22:52

Mimicking this lovely answer, we compute the extended Euclidean GCD to find $$25=16(n^2-n-1)^2+(-8n^3+12n^2+14n-9)(2n-1)$$
Hence, if $2n-1$ divides $(n^2-n-1)^2$, then it also divides $25$. We test each solution to $2n-1\in\{\pm 1, \pm 5\pm 25\}$.