Task 3. Vlad wants to write one number on each side of several cubes so that he can get any 30-digit number by arranging some of the cubes side by side. What is the minimum number of cubes he needs?
Solution. Vlad can arrange any sequence of six digits by taking the following set of 10 cubes (since each digit is written on six cubes in the set):

| cube 1 | 1 | 2 | 3 | 4 | 5 | 6 |  |  |  |  |  |  |  |  |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| cube 2 |  | 2 | 3 | 4 | 5 | 6 | 7 |  |  |  |  |  |  |  |
| cube 3 |  |  | 3 | 4 | 5 | 6 | 7 | 8 |  |  |  |  |  |  |
| cube 4 |  |  |  | 4 | 5 | 6 | 7 | 8 | 9 |  |  |  |  |  |
| cube 5 |  |  |  |  | 5 | 6 | 7 | 8 | 9 | 0 |  |  |  |  |
| cube 6 |  |  |  |  |  | 6 | 7 | 8 | 9 | 0 | 1 |  |  |  |
| cube 7 |  |  |  |  |  |  | 7 | 8 | 9 | 0 | 1 | 2 |  |  |
| cube 8 |  |  |  |  |  |  |  | 8 | 9 | 0 | 1 | 2 | 3 |  |
| cube 9 |  |  |  |  |  |  |  |  | 9 | 0 | 1 | 2 | 3 | 4 |
| cube 10 |  |  |  |  |  |  |  |  |  | 0 | 1 | 2 | 3 | 4 |

Therefore, Vlad can arrange any 30-digit number with five such sets, i.e., a total of 50 cubes.

On the other hand, to arrange a number written with 30 identical digits, Vlad must have 30 cubes on which this digit is written. The digit 0 is written on at least 29 cubes. Thus, the number of cubes is at least $\frac{1}{6} \cdot(9 \cdot 30 + 29) = 49 \frac{5}{6}$, i.e., the number of cubes is at least 50.