1. How many and which digits will be needed to write down all natural numbers from 1 to $10^{2017}$ inclusive?
Solution. First, consider all natural numbers from 1 to $10^{2017}-1=\underbrace{99 \ldots 9}_{2017 \text { of them }}$. In this case, all numbers with fewer than 2017 digits will be padded with leading zeros to make them 2017-digit numbers, and we will add one more number $\underbrace{00 \ldots 0}_{2017 \text { of them }}$. We end up with $10^{2017}$ 2017-digit numbers, for which we need $2017 \cdot 10^{2017}$ digits. In this set, each of the 10 digits will be used an equal number of times, since they are all equally significant. Therefore, each digit will be used $2017 \cdot 10^{2016}$ times.

Now let's count the number of extra (leading) zeros. There are 9 one-digit numbers, 90 two-digit numbers ($99-9=90$), 900 three-digit numbers ($999-99=900$), and so on. Since we added 2016 zeros to the left of a one-digit number, 2015 zeros to a two-digit number, and so on, the total number of extra zeros (not counting the first number, which was written as $\underbrace{00 \ldots 0}_{2017 \text { of them }}$) will be

$2016 \cdot 9 + 2015 \cdot 90 + 2014 \cdot 900 + \ldots + 2 \cdot 9 \cdot 10^{2014} + 1 \cdot 10^{2015} = \sum_{k=1}^{2016}(2017-k) \cdot 10^{k-1}$.

Now, let's prepend 1 to the number $\underbrace{00 \ldots 0}_{2017 \text { of them }}$. In doing so, we obtain all integers in the range from 1 to $10^{2017}$. We see that for their representation, $2017 \cdot 10^{2017}$ twos, threes, and so on up to nines were used, $2017 \cdot 10^{2017} + 1$ ones, and the number of zeros is

$$
2017 \cdot 10^{2017} - \sum_{k=1}^{2016}(2017-k) \cdot 10^{k-1}
$$