## Task 2 - 160712

Imagine the numbers $1,2,3,4, \ldots$ and so on up to 100 written consecutively, forming a number $z$ of the form

$$
z=12345678910111213 \ldots 9899100
$$

a) How many digits does $z$ have?

b) 100 digits of the number $z$ should be deleted so that the number $z^{\prime}$ represented by the remaining digits is as large as possible. The order of the remaining digits in $z^{\prime}$ should not be changed.

Determine which digits to delete, and give the first ten digits of the new number $z^{\prime}$!
a) The given number $z$ consists of 9 single-digit numbers, $9 \cdot 10$ two-digit numbers, and the three-digit number 100. It thus contains $9 \cdot 1 + 90 \cdot 2 + 1 \cdot 3 = 192$ digits.

b) Of the total 192 digits of $z$, exactly 92 digits should remain in the number $z'$. Of two 92-digit numbers that begin with a different number of nines, the one that begins with the larger number of nines is the larger number.

Before the first nine that appears in the number, there are 8 digits different from nine, before the second nine there are 19 more, and before the third, fourth, and fifth nines, there are 19 more different from nine each.

If we remove these, a total of 84 digits $(8 + 4 \cdot 19 = 84)$ are removed. There are still 16 digits to be removed.

The number then begins as follows: 999995051525354555657505960

It is no longer possible to remove the 19 digits before the next (originally sixth) nine, as then more than 100 digits would be removed.

Of two 92-digit numbers that begin with 5 nines and have different digits in the sixth place, the one that has the larger digit in the sixth place is the larger number. In our case, the eight is not an option, as then 17 digits would still need to be removed. Therefore, the sixth place can have at most a seven. This is also achievable if the next 15 digits are removed.

Accordingly, it can be shown that the last digit to be removed must be the five following the seven. The first ten digits of the desired number $z'$ are thus 9999978596.