25. Suppose $x$ and $y$ are integers such that
$$
(x-2004)(x-2006)=2^{y} \text {. }
$$

Find the largest possible value of $x+y$.
25. Ans: 2011
$$
\begin{aligned}
(x-2004)(x-2006)=2^{y} & \Longrightarrow(x-2005+1)(x-2005-1)=2^{y} \\
& \Longrightarrow(x-2005)^{2}-1=2^{y} \\
& \Longrightarrow(x-2005)^{2}=1+2^{y} .
\end{aligned}
$$

Write $n=|x-2005|$. Then we have
$$
n^{2}=1+2^{y} \Longrightarrow 2^{y}=(n-1)(n+1) \text {. }
$$

Observe that the above equality implies easily that $n \neq 0,1$. Thus, $n-1$ and $n+1$ are positive integers, and both $n-1$ and $n+1$ are powers of 2 . Write $n-1=2^{a}$. Then
$$
n+1=2^{\alpha}+2=2\left(2^{\alpha-1}+1\right) .
$$

Since $n \geq 2$, it follows that $n+1 \geq 3$. Moreover, since $n+1$ is a power of 2 , it follows that $n+1 \geq 4$ and thus $\frac{n+1}{2} \geq 2$. Hence $2^{a-1}+1$ is a positive integer and it is also a power of 2 . Clearly, $2^{a-1}+1>1$. Thus $2^{a-1}+1 \geq 2 \Longrightarrow a \geq 1$. If $a>1$, then $2^{a-1}+1>2$ and it is odd, which is not possible. Thus we have $a=1$. Thus,
$$
n=1+2=3 \text {. }
$$

Then
$$
2^{y}=(3-1)(3+1)=8 \Longrightarrow y=3 \text {. }
$$

It follows that
$$
\begin{aligned}
(x-2005)^{2}=1+2^{3}=9=3^{2} & \Longrightarrow x=2005 \pm 3 \\
& \Longrightarrow x=2008 \text { or } 2002 .
\end{aligned}
$$

Thus the largest possible value of $x+y$ is $2008+3=2011$ when $x=2008$.