## Task 2 - 340732

Imagine the numbers 1, 2, 3, 4, ... up to 100 written consecutively so that a number $z$ of the form $z=12345678910111213 \ldots .9899100$ is formed.

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 digits remaining in $z^{\prime}$ from $z$ should not be changed.

Determine which digits to delete, and give the first 10 digits of the new number $z^{\prime}$!
a) The number $z$ has its digits from the 9 single-digit numbers $1, \ldots, 9$, the 90 two-digit numbers 10, ..., 99, and the three-digit number 100. Thus, it has $9 + 90 \cdot 2 + 3 = 192$ digits.

b) Of the 192 digits of the number $z$, exactly 92 digits should remain in $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 $z$, 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 again 19 more digits different from nine each. If these are removed, a total of $8 + 4 \cdot 19 = 84$ digits have already been removed; from the remaining number

$$
999995051525354555657585960 \ldots 9899100
$$

exactly 16 digits still need to be removed.

These cannot be the 19 digits up to the first nine following 99999, nor the 17 digits up to the first eight following 99999. Of any two 92-digit numbers that begin with 99999 and have different digits at the sixth position, the one with the larger digit at the sixth position is always the larger number.

The largest possibility here is to remove the first 15 digits following 99999 to reach the beginning 999997. After that, exactly one more digit needs to be removed.

Of the two possibilities, to remove the five following 999997 or to leave it (and remove a later digit), removing the five yields the larger number.

Thus, it has been determined which 100 digits from $z$ should be removed to obtain the largest possible number $z'$. The first ten digits of this number are 9999978596.