Exercise 12. Find all pairs of positive integers $(x, y)$ such that $2^{x}+5^{y}+2$ is a perfect square.
Solution to Exercise 12 Here we are dealing with a Diophantine equation involving a square and a power of 2. We can see by testing small cases that $(x, y)=(0,0)$ and $(1,1)$ are solutions. Since we have a square and a power of 2, we are very tempted to look modulo 4 or 8. Let's first look modulo 4 to see if there is a contradiction. For this, we will first handle the case where $x \geqslant 2$.

First, note that if $x \geqslant 2, 2^{x}+5^{y}+2 \equiv 1+2 \equiv 3 \pmod{4}$ and 3 is not a square modulo 4 (squares are 0 and 1 modulo 4). Therefore, we must have $x=1$ or $x=0$.

Now let's rewrite the equation for the case $x=1$. For $x=1$, let $y$ be a positive integer such that $2+5^{y}+2=5^{y}+4$ is a perfect square. Note that since 4 is a square, we can factorize.

Let $k$ be a positive integer such that $k^{2}=5^{y}+4$, so we have $(k-2)(k+2)=5^{y}$. Note that since $k+2>0$, we have $k-2>0$ and $k+2$ and $k-2$ are powers of 5. If $k-2>1$, then 5 divides $k+2$ and $k-2$ so 5 divides $k+2-(k-2)=4$, which is a contradiction.

Thus, $k-2=1$ so $k=3$, so $5^{y}+4=9$ so $y=1$. Conversely, if $(x, y)=(1,1)$, $2^{x}+5^{y}+2=9$ is a perfect square.

For $x=0$, let $y$ be such that $1+5^{y}+2=5^{y}+3$ is a square, so let $k \geqslant 0$ such that $k^{2}=5^{y}+3$. Here, since we have squares and powers of 5, we can try to look modulo 5. If $y \geqslant 1$, then we have $k^{2} \equiv 3 \pmod{5}$, but the squares modulo 5 are 1 and 4, which is a contradiction. Therefore, we must have $y=0$. Conversely, if $(x, y)=(0,0)$, $2^{x}+5^{y}+2=4$ is a perfect square.

The solutions are therefore the pairs $(0,0)$ and $(1,1)$.

Comment from the graders: This exercise was very well done overall. For the case $x=0$, most students used the fact that a square is not congruent to 3 modulo 5, but it was important not to forget to handle the case $y=0$ separately!