Find all integers n such that $\;\frac{n^2-9}{n^2-5n+4}$ is an integer. 
Find all integers such that $\;\dfrac{n^2-9}{n^2-5n+4}\;$ is an integer.

I am really struggling to figure this out. I can tell that -3,3, and 5 are solutions but I don't know how to show that these are the only solutions or if they even are the only solutions.
 A: HINT: Divide it out:
$$1+\frac{5n-13}{n^2-5n+4}\;.$$
This is an integer if and only if 
$$\frac{5n-13}{n^2-5n+4}\tag{1}$$
is an integer. But the denominator of $(1)$ increases faster than the numerator, so there’s an upper bound on $|n|$ beyond which it can’t be an integer. Find that upper bound, and you can check the finite number of possibilities below it; it isn’t terribly big.
A: The denominator is $(n-1)(n-4)$. If $n^2\ne 9$, we must have that $n-4$ divides $n^2-9$.
Note that $\frac{n^2-9}{n-4}=n+4+\frac{7}{n-4}$. So the only candidates are those $n$ such that $n-4$ divides $7$. That gives the short list $n=5$, $n=3$, $n=11$, and $n=-3$. Test them all.
A: Another, shorter (than my other answer) answer again only using divisibility.
This factors as $\frac{(n-3)(n+3)}{(n-4)(n-1)}$. Note that $n$ cannot be $4$ or $1$. The factors $(n-3)$ and $(n-4)$ are relatively prime, so $(n-4)$ must divide the numerator's other factor $(n+3)$.
These numbers are $7$ apart. Their gcd must divide $7$ so it is either $1$ or $7$, but their gcd is $|n-4|$ (remember that $(n-4)$ divides into $(n+3)$). This leaves four possible solutions.


*

*$n-4=1\implies n=5$

*$n-4=-1\implies n=3$

*$n-4=7\implies n=11$

*$n-4=-7\implies n=-3$


They all check out in the larger rational expression as yielding integers except $n=11$.
A: Longer, but using only divisibility considerations:
This factors as $\frac{(n-3)(n+3)}{(n-4)(n-1)}$. Note $n$ cannot be $1$ or $4$. 
So $|n-1|\geq1$, and if $p$ is a prime dividing $n-1$, then $p$ has to divide $n-3$ or $n+3$. So mod $p$, either $n\equiv1\equiv3$ or $n\equiv1\equiv-3$. Either way, $p$ must be $2$, and $n-1=\pm2^k$ for some $k\geq0$. 
$$\frac{(\pm2^k-2)(\pm2^k+4)}{(\pm2^k-3)(\pm2^k)}$$
Now we see $k$ can't be $4$ or more, or else the denominator is divisible by $16$ and the numerator is not. So there are two ($\pm$) cases for each of $k=0,1,2,3$:
$$\begin{align}
\frac{(\pm1-2)(\pm1+4)}{(\pm1-3)(\pm1)}&&\frac{(\pm2-2)(\pm2+4)}{(\pm2-3)(\pm2)}&&\frac{(\pm4-2)(\pm4+4)}{(\pm4-3)(\pm4)}&&\frac{(\pm8-2)(\pm8+4)}{(\pm8-3)(\pm8)}
\end{align}$$
There are eight options to check. 
$$\begin{align}
\frac{5}{2}&&0&&4&&\frac{9}{5}\\
\frac{-9}{4}&&\frac{4}{-5}&&0&&\frac{5}{11}
\end{align}$$
The integers happened for $$n=2^1+1=3$$ $$n=2^2+1=5$$  $$n=-2^2+1=-3$$
