Golovanov A.S.

How many more perfect squares not exceeding $10^{20}$ are there: those for which the seventeenth digit from the end is 7, or those for which the seventeenth digit from the end is 8?
Let's write each number not exceeding $10^{20}$ with twenty digits, padding it with the necessary leading zeros. We will fix the first three digits and verify that for any choice of these three digits, there are more squares with these first three digits and the fourth digit being 7 than squares with these first three digits and the fourth digit being 8.

We need to compare the number of perfect squares in the half-interval $\left[10^{16}(A-1), 10^{16} A\right)$ with the number of perfect squares in the half-interval

$\left[10^{16} A, 10^{16}(A+1)\right)\left(A>10^{4}\right.$ - the number obtained by appending an 8 to the three fixed first digits), that is, the number of natural numbers in the half-interval $\left[10^{8} \sqrt{A-1}, 10^{8} \sqrt{A}\right)$ with the number of natural numbers in the half-interval $\left[10^{8} \sqrt{A}, 10^{8} \sqrt{A+1}\right)$. Since the number of natural numbers in a half-interval differs from its length by no more than 1, it is sufficient to show that the lengths of the last half-intervals differ by more than 2. This can be verified directly:

$$
\begin{gathered}
\left(10^{8} \sqrt{A}-10^{8} \sqrt{A-1}\right)-\left(10^{8} \sqrt{A+1}-10^{8} \sqrt{A}\right)=10^{8}\left(\frac{1}{\sqrt{A}+\sqrt{A-1}}-\frac{1}{\sqrt{A+1}+\sqrt{A}}\right)= \\
10^{8} \cdot \frac{\sqrt{A+1}-\sqrt{A-1}}{(\sqrt{A}+\sqrt{A-1})(\sqrt{A+1}+\sqrt{A})}=\frac{2 \cdot 10^{8}}{(\sqrt{A}+\sqrt{A-1})(\sqrt{A+1}+\sqrt{A})(\sqrt{A+1}+\sqrt{A-1})} \\
>\frac{2 \cdot 10^{8}}{\left(2 \cdot \sqrt{10^{4}}\right)^{3}}=25>2 .
\end{gathered}
$$

## Answer

Those with the 17th digit from the end being 7.