a) Given that the decimal representation of $5^{2018}$ has 1411 digits and starts with 3 (the leftmost non-zero digit is 3), for how many integers $1 \leq n \leq 2017$ does the number $5^{n}$ start with 1?

b) The integers $4^{52}$ and $5^{52}$ both start with the digit 2. If the decimal representations of the powers $4^{n}$ and $5^{n}$, with $n>0$ and integer, start with the same digit $d$, what are the possible values of this digit?
Solution

a) If $5^{k}$ starts with $a$ and has $j$ digits, then

$$
10^{j}5 \cdot 2 \cdot 10^{j}=10^{j+1}
$$

would have at least $j+1$ digits. Therefore, the problem reduces to finding the values of $k \in\{1,2, \ldots, 2017\}$ such that $5^{k}$ and $5^{k+1}$ have the same number of digits. Between two consecutive powers of 5, the number of digits increases by at most one unit. Since $5^{2018}$ has 1411 digits, among the powers $5^{1}$, $5^{2}, \ldots, 5^{2018}$, there are 1410 increases in the number of digits between consecutive powers, and exactly $2017-1410=607$ values of $k$ for which $5^{k}$ and $5^{k+1}$ have the same number of digits. That is, the number of powers that start with 1 is 607.

b) Since $4^{n}$ and $5^{n}$ start with the same digit $d$, there exist non-negative integers $i$ and $j$ such that

$$
\begin{aligned}
& d \cdot 10^{i} \leq 4^{n} < (d+1) \cdot 10^{i} \\
& d \cdot 10^{j} \leq 5^{n} < (d+1) \cdot 10^{j}
\end{aligned}
$$

Analyzing the cubes

$$
1^{3}, 2^{3}, 3^{3}, \ldots, 9^{3}, 10^{3}
$$

we can conclude that the only digits $d$ for which the interval $\left(d^{3},(d+1)^{3}\right)$ contains a power of 10 are $d=2$ and $d=4$. Indeed, in addition to the example given in the statement ensuring that $d=2$ is possible, $4^{11}$ and $5^{11}$ start with the digit 4.