# 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.

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$.

• Should it be 17 instead of 15? – N.U. Aug 7 '13 at 16:03
• Yes, than you, I had already corrected it. I do have a lot of trouble with minus signs. – André Nicolas Aug 7 '13 at 16:07
• I've never liked contests' questions and all that, but the educative part of me wants to ask: why is it "more convenient" to look at hte numerator multiplied by four? One of the answers here gives a complete and rather basic development of the answer, yet this one's much shorter, but the student (and I myself) could be asking "How in the holy name of Merlin the Wizard am I to come up with what's more convenient to do just like that, out of the blue"? – DonAntonio Aug 7 '13 at 18:41
• OK, it wasn't out of the blue exactly. I saw myself dividing by $2n+1$, imagined getting fractions, which in elementary number theory are important to avoid. Since we are dividing by an odd number, we don't change the problem by multiplying top by a power of $2$. Now we have no fractions, except for the almost unavoidable one. – André Nicolas Aug 7 '13 at 18:46
• I think also it depends on how you see the numerator and denominator. If you see them as integers then none of this is clear (but see one of the other answers for a purely number theoretical proof), it is only once you see them as polynomials that things become more natural. Abstractly, we know that $\mathbb{Z}[x]$ is not a Euclidean Domain but $\mathbb{Q}[x]$ is, so in doing this reduction of $x^2+4$ modulo $2x+1$ we are almost certain to introduce fractional coefficients. The pre-multiplication by $4$ avoids this. – fretty Aug 7 '13 at 19:08

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.

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?$