4. In each of the following 7-digit natural numbers:
1001011,5550000,3838383,7777777,
every digit in the number appears at least 3 times. Find the number of such 7 -digit natural numbers.
4. Ans: 2844
If only one digit appears, then there are 9 such numbers. If the two digits that appear are both nonzero, then the number of such numbers is
$$
2 \times\binom{ 7}{3}\binom{9}{2}=2520 .
$$

If one of two digits that appear is 0 , then the number of such numbers is
$$
\left(\binom{6}{4}+\binom{6}{3}\right) \times\binom{ 9}{1}=315
$$

Hence the answer is $9+2520+315=2844$.