Find all positive integers $n$ such that $n+2008$ divides $n^2 + 2008$ and $n+2009$ divides $n^2 + 2009$

I wrote \begin{align} n^2 + 2008 &= (n+2008)^2 - 2 \cdot 2008n - 2008^2 + 2008 \\ &= (n+2008)^2 - 2 \cdot 2008(n+2008) + 2008^2 + 2008 \\ &= (n+2008)^2 - 2 \cdot 2008(n+2008) + 2008 \cdot 2009 \end{align} to deduce that $n+2008$ divides $n^2 + 2008$ if and only if $n+2008$ divides $2008 \cdot 2009$.

Similarly, I found that $n+2009$ divides $n^2 + 2009$ if and only if $n+2009$ divides $2009 \cdot 2010$.

I can't seem to get anywhere from here. I know that $n=1$ is an obvious solution, and I think it's the only one, although I can't prove/disprove this. I know that any two consecutive integers are coprime but I haven't been able to use this fact towards the solution.

Could anyone please give me any hints?

For the record, this is a question from Round 1 of the British Mathematical Olympiad.

• $$n+2008$$ needs to be factor of $$2008\cdot2009$$ – lab bhattacharjee Jan 10 '16 at 17:13
• Yes, I know that, and $n+2009$ needs to be a factor of $2009.2010$ but I'm not sure what more I could deduce from this. – Ecasx Jan 10 '16 at 17:15
• Note that $(2008\cdot2009)/(1+2008)=2008$ and $(2009\cdot2010)/(1+2009)=2009$, and their difference is $1$. Furthermore, as $n$ increases, the difference $\frac{2009\cdot2010}{n+2009}-\frac{2008\cdot2009}{n+2008}$ "should" get smaller, intuitively speaking. In particular, if the difference is strictly between $0$ and $1$, then the terms cannot both be integers. See if you can show that is indeed the case. – Joey Zou Jan 10 '16 at 17:37

Here another approach

Since $(n+2008)|( n^{2} + 2008)$ and $(n+2009) |( n^{2} + 2009)$ then

$(n+2008)k = n^2 + 2008$ and $(n+2009)m = n^2 + 2009$ for some $k,m \in \mathbb{Z}$

$\textbf{Case 1:}$ $k=1$ or $m=1$

$(n+2008) = n^2 + 2008$ or $(n+2009) = n^2 + 2009$

in any case leads to $n^2-n=0$ that is $n=1$ and $n=0$

$\textbf{Case 2:}$ $m>k>1$

$$n^2+2009=(n+2009)m = (n+2008)m+m > (n+2008)k + m > n^2+2009$$ which is impossible

$\textbf{Case 3:}$ $k>m>1$

$$n^2+2008=(n+2009-1)k = (n+2009)k - k \ge (n+2009)(m+1) - k = (n+2009)m +(n+2009-k) \ge n^2+2009$$ also impossible, the last inequality holds because $k< n+2009$, suppose not

$k \ge n+2009 >n+2008 \Rightarrow n^2 + 2008 =(n+2008)k > (n+2008)^2 > n^2 + 2008$ a contradiction

$\textbf{Case 4:}$ $k=m>1$

$$(n+2008)k+1=(n+2009)k \Longrightarrow k =1 \Longrightarrow n=1$$

So the solutions are $\boxed{n=1}$ and $\boxed{n=0}$

• Thank you. That's a very nice solution. I'm startled that it doesn't use any real number theory, when the question looks quite 'number theoretic'! – Ecasx Jan 10 '16 at 21:30
• actually it does, look the gnasher729's solution – JulianP Jan 10 '16 at 21:45

Subtracting n + 2008 from $n^2 + 2008$ resp. n + 2009 from $n^2 + 2009$ shows that n + 2008 and n + 2009 both divide n (n - 1). Since n+2008 and n+2009 have no common factor other than 1, (n + 2008) * (n + 2009) divides n (n - 1). But (n + 2008) * (n + 2009) ≥ n (n - 1), so n (n-1) must be 0, and n = 0 or n = 1. n = 1 is the only positive solution.