4.1. (14 points) How many six-digit numbers exist whose sum of digits equals 51?
Answer: 56.

Solution. Since the maximum sum of the digits of a six-digit number is $6 \cdot 9=54$, the sought numbers are $699999, 789999, 888999$, as well as all numbers obtained from them by rearranging the digits. The first of these numbers can form 6 six-digit numbers (the digit 6 can be in any of the 6 positions), the second can form $6 \cdot 5=30$ numbers (6 options for placing one of the digits 7, 8, and another 5 for the other), and the third can form $\frac{6 \cdot 5 \cdot 4}{1 \cdot 2 \cdot 3}=20$ numbers (6 options for one digit 8, another 5 options for the second, and 4 options for the third, but since these digits are the same, we have counted each number $1 \cdot 2 \cdot 3=6$ times). In total, $6+30+20=56$ numbers.