Need help with a number theory question I can't solve this question I got from a Math Olympiad past paper: 
Find all integers $a$ such that $\frac{a^2+4}{2a+1}$ is also an integer
I know $a$ can be $0$ and $-1$ but I can't ascertain if there are other values $a$ can take. 
 A: It is more convenient to solve the equivalent problem of determining when $\dfrac{4n^2+16}{2n+1}$ is an integer.
Divide the polynomial $4x^2+16$ by $2x+1$ in the usual way. We get 
$$\frac{4x^2+16}{2x+1}=2x-1+\frac{17}{2x+1}.$$
Now it is easy to determine the $n$ such that $\dfrac{17}{2n+1}$ is an integer: $2n+1$ must take on one of the values $\pm 1$ or $\pm 17$.
A: André's answer is pretty much the best way to do this. A more naïve approach is as follows:
Suppose $\frac{a^2+4}{2a+1} = k\in\mathbb{Z}$. Then:
$a^2 - 2ka + (4-k) = 0$
This is a quadratic equation with solutions:
$a = \frac{2k \pm \sqrt{4k^2 - 4(4-k)}}{2}= k \pm\sqrt{k^2+k-4}$
For $a$ to be an integer we thus need $k^2 + k - 4$ to be a perfect square, i.e. $k^2 + k - 4 = m^2$. Rearrange and get another quadratic equation with solutions:
$k = \frac{-1 \pm \sqrt{1 + 4(4+m^2)}}{2}$
Again we want $k$ to be an integer so need $4m^2 + 17 = n^2$ for some integer $n$.
So we get a difference of two squares equation: $n^2 - (2m)^2 = 17$. Factorising tells us that $(n+2m)(n-2m) = 17$. Solving gives $m=\pm 4$, which tells us that $k=4,-5$ giving $a = -9,-1,0,8$.
You can check all $4$ of these possibilities work and so we are done.
A: HINT:
Let integer $d$ divides both $2a+1,a^2+4$
$\implies d$ divides $a(2a+1)-2(a^2+4)=a-8$
Again, as $d$ divides $a-8$ and $2a+1,d$ must divide $2a+1-2(a-8)=17$
$\implies 2a+1$ must divide $17$
Now, what are the divisors of $17?$
