
N6. Find all triples $(a, b, c)$ of nonnegative integers that satisfy

$$
a!+5^{b}=7^{c}
$$


Solution. We cannot have $c=0$ as $a!+5^{b} \geqslant 2>1=7^{0}$.

Assume first that $b=0$. So we are solving $a!+1=7^{c}$. If $a \geqslant 7$, then $7 \mid a!$ and so $7 \nmid a!+1$. So $7 \nmid 7^{c}$ which is impossible as $c \neq 0$. Checking $a0$. In this case, if $a \geqslant 5$, we have $5 \mid a$ !, and since $5 \mid 5^{b}$, we have $5 \mid 7^{c}$, which obviously cannot be true. So we have $a \leqslant 4$. Now we consider the following cases:

Case 1. Suppose $a=0$ or $a=1$. In this case, we are solving the equation $5^{b}+1=7^{c}$. However the Left Hand Side of the equation is always even, and the Right Hand Side is always odd, implying that this case has no solutions.

Case 2. Suppose $a=2$. Now we are solving the equation $5^{b}+2=7^{c}$. If $b=1$, we have the solution $(a, b, c)=(2,1,1)$. Now assume $b \geqslant 2$. We have $5^{b}+2 \equiv 2 \bmod 25$ which implies that $7^{c} \equiv 2 \bmod 25$. However, by observing that $7^{4} \equiv 1 \bmod 25$, we see that the only residues that $7^{c}$ can have when divided with 25 are $7,24,18,1$. So this case has no more solutions.

Case 3. Suppose $a=3$. Now we are solving the equation $5^{b}+6=7^{c}$. We have $5^{b}+6 \equiv 1 \bmod 5$ which implies that $7^{c} \equiv 1 \bmod 5$. As the residues of $7^{c}$ modulo 5 are $2,4,3,1$, in that order, we obtain $4 \mid c$.

Viewing the equation modulo 4 , we have $7^{c} \equiv 5^{b}+6 \equiv 1+2 \equiv 3 \bmod 4$. But as $4 \mid c$, we know that $7^{c}$ is a square, and the only residues that a square can have when divided by 4 are 0,1 . This means that this case has no solutions either.

Case 4. Suppose $a=4$. Now we are solving the equation $5^{b}+24=7^{c}$. We have $5^{b} \equiv 7^{c}-24 \equiv 1-24 \equiv 1 \bmod 3$. Since $5 \equiv 2 \bmod 3$, we obtain $2 \mid b$. We also have $7^{c} \equiv 5^{b}+24 \equiv 4 \bmod 5$, and so we obtain $c \equiv 2 \bmod 4$. Let $b=2 m$ and $c=2 n$. Observe that

$$
24=7^{c}-5^{b}=\left(7^{n}-5^{m}\right)\left(7^{n}+5^{m}\right)
$$

Since $7^{n}+5^{m}>0$, we have $7^{n}-5^{m}>0$. There are only a few ways to express $24=$ $24 \cdot 1=12 \cdot 2=8 \cdot 3=6 \cdot 4$ as a product of two positive integers. By checking these cases we find one by one, the only solution in this case is $(a, b, c)=(4,2,2)$.

Having exhausted all cases, we find that the required set of triples is

$$
(a, b, c) \in\{(3,0,1),(1,2,1),(4,2,2)\}
$$
