## Task 4.

Determine all pairs of natural numbers $(m, n)$ for which

$$
2^{m}=7 n^{2}+1
$$
## Solution.

Notice that $2^{m} \equiv 1(\bmod 7)$, from which we conclude that $m=3 k$ for some $k \in \mathbb{N}$. Now we have

$$
\left(2^{k}-1\right)\left(2^{2 k}+2^{k}+1\right)=7 n^{2}
$$

Let $A=2^{k}-1$ and $B=2^{2 k}+2^{k}+1$. Let $d$ be the greatest common divisor of $A$ and $B$, and note that $d$ is odd. Furthermore, the number $d$ divides the number $B-A^{2}=2^{k}+2^{k+1}=3 \cdot 2^{k}$, and since $d$ is odd, we conclude that $d=1$ or $d=3$.

Thus, we have exactly four possibilities for the factorization of the numbers $A$ and $B$. In each case, we assume that $a$ and $b$ are relatively prime natural numbers.

1. Case. $A=7 a^{2}$ and $B=b^{2}$. This is impossible because $\left(2^{k}\right)^{2}<B<\left(2^{k}+1\right)^{2}$, i.e., $B$ cannot be a perfect square.
2. Case. $A=a^{2}$ and $B=7 b^{2}$. If $k \geqslant 2$, note that $B \equiv 1(\bmod 4)$, i.e., $3 b^{2} \equiv 1(\bmod 4)$, which is impossible. Therefore, it must be $k=1$ and we get the solution $(m, n)=(3,1)$.
3. Case. $A=21 a^{2}$ and $B=3 b^{2}$. Just like in the second case, we conclude that it must be $k=1$, but this is impossible in this case because $21 a^{2}=A=2^{1}-1=1$.
4. Case. $A=3 a^{2}$ and $B=21 b^{2}$. Thus, the number $A$ is divisible by 3, i.e., $2^{k} \equiv 1(\bmod 3)$, from which we conclude that $k=2 l$, for some $l \in \mathbb{N}$. Now we have

$$
\left(2^{l}-1\right)\left(2^{l}+1\right)=3 a^{2}
$$

Since the numbers $2^{l}-1$ and $2^{l}+1$ are relatively prime, we have only two possibilities:

$$
\begin{aligned}
& 2^{l}-1=c^{2} \\
& 2^{l}+1=3 d^{2}
\end{aligned} \quad \text { or } \quad \begin{aligned}
& 2^{l}-1=3 c^{2} \\
& 2^{l}+1=d^{2}
\end{aligned}
$$

where $c$ and $d$ are relatively prime natural numbers.

In the first possibility, if $l \geqslant 2$, then $3 d^{2} \equiv 1(\bmod 4)$, which is impossible. Therefore, it must be $l=1$ and here we get another solution $(m, n)=(6,3)$.

In the second possibility, we have $2^{l}=(d-1)(d+1)$. Since the greatest common divisor of the numbers $d-1$ and $d+1$ is at most 2 and their product is a power of 2, we conclude that $d-1=2$, i.e., $l=3$, but then $3 c^{2}=2^{3}-1=7$, which is impossible.

Finally, all solutions to the given equation are $(m, n)=(3,1)$ and $(m, n)=(6,3)$.

## CROATIAN MATHEMATICAL OLYMPIAD

## Second day

## Zagreb, May 6, 2018.