4B. Among the first 10000 natural numbers, how many end in 1 and can be written in the form $5^{m}+8^{n}$?
Solution. Since $5^{m}$ ends in 5, $8^{n}$ must end in 6. We have

$$
8^{1}=8, \quad 8^{2}=64, \quad 8^{3}=512, \quad 8^{4}=4096, \quad 8^{5}>10000
$$

Thus, $n=4$ and from

$$
5^{m}+8^{n} \leq 10000 \Rightarrow 5^{m} \leq 5904
$$

Since

$$
\begin{aligned}
& 5^{1}=5,5^{2}=25,5^{3}=125,5^{4}=625 \\
& 5^{5}=3125,5^{6}=15625,15625>5904 \Rightarrow m \in\{1,2,3,4,5\}
\end{aligned}
$$

It follows that there are 5 numbers less than 10,000, which end in 1 and can be written in the form $5^{m}+8^{n}$. These are:

$$
4101=5^{1}+8^{4}, 4121=5^{2}+8^{4}, 4221=5^{3}+8^{4}, 4721=5^{4}+8^{4} \text { and } 7211=5^{5}+8^{4} .
$$

## 2nd Year