7. The decimal representation of a natural number $N$ consists only of ones and twos. It is known that by erasing digits from this number, any of the 10000 numbers consisting of 9999 ones and one two can be obtained. Find the smallest possible number of digits in the representation of $N$. (G. Chelnokov)
Answer: 10198. Solution: Example. The number 1...121...12...21...121...1, where there are 100 twos, 99 ones at the beginning and end, and 100 ones between adjacent twos. The number consisting of 9999 ones and a two, where before the two there are $100 m+n$ ones ($0 \leq m, n \leq 99$), is obtained by deleting all twos except the $(m+1)$-th, 99 ones before it, and $n$ ones after it. Estimation. Note that in the number $N$ there are no two consecutive twos - otherwise, it can be shortened by deleting one of these twos. Let the number $N$ have $k$ twos, with $a_{0}$ ones before the first two, $a_{1}$ ones between the first and second, ..., and $a_{k}$ ones after the last two. Let $s=a_{0}+\ldots+a_{k}$. To obtain a number where there is one one before the two, we will have to delete at least $a_{0}-1$ ones. Therefore, the number $s-\left(a_{0}-1\right)$ must be at least 9999, i.e., $s-a_{0} \geq 9998$. To obtain a number where there are $a_{0}+1$ ones before the two, we will have to delete the first two and at least $a_{1}-1$ ones, from which we get the inequality $s-a_{1} \geq 9998$. To obtain a number where there are $a_{0}+a_{1}+1$ ones before the two, we will have to delete the first two twos and at least $a_{2}-1$ ones, from which we get the inequality $s-a_{2} \geq 9998$. Reasoning similarly, we get that the inequality $s-a_{i} \geq 9998$ holds for all $i$ from 0 to $k-1$; in addition, to obtain a number where the two is the last, it is required that $s-a_{k} \geq 9999$. Adding all these inequalities, we get the inequality $(k+1) s-s \geq 9998(k+1)+1 \Rightarrow k s>9998(k+1) \Rightarrow$
$s>9998+9998 / k$. Since the desired number also has $k$ twos, the number of digits in it is greater than $9998+9998 / k+k \geq 9998+2 \sqrt{9998}>10197$, which is what we needed to prove.