How many numbers smaller than one million, their sum of digits is at least 20?
My attempt:
Since I don't know how to handle the "at least" part, I'll be using a complement:
The general case is all the digit combination up to one million: $9\cdot10^5$
Complement: the sum is at most 20.
Now we need to find all the solutions for $x_1+...+x_6=n : n\in[0,20]:x_i\in[0,9]$
So I found the generating sums function: $\frac{(1-x^{10})^6}{(1-x)^7}$
And the coefficients I got from that for $x^{20}$ are: $\binom{20+6}{6}-6\binom{10+6}6+\binom 6 2$
So the final answer is: $9\cdot10^5-\left(\binom{20+6}{6}-6\binom{10+6}6+\binom 6 2\right)=717803$
But I'm not sure I got the general case right, is it really all the 6 digit combinations?
To simplify the calculations, we will work with nonnegative integers.
There are $1,000,000$ nonnegative integers less than $1,000,000$ since $0$ is nonnegative.
If the sum of the digits of a nonnegative integer is not at least $20$, then the sum of its digits is at most $19$.
A number less than $1,000,000$ has at most six digits. We can append leading zeros to a number with fewer than six digits to represent it as a six-digit number. For instance, we regard $473$ as $000473$.
Thus, we wish to exclude nonnegative integers whose digits satisfy the inequality $$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 \leq 19$$ subject to the restrictions that $x_k \leq 9$ for $1 \leq k \leq 6$.
To handle the inequality, let $d = 19 - (x_1 + x_2 + x_3 + x_4 + x_5 + x_6)$. Then $d$ is a nonnegative integer and $$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + d = 19$$ If there were no restrictions on the size of $x_k$ for $1 \leq k \leq 6$, then the number of solutions of this equation in the nonnegative integers would be equal to the number of ways we can place six addition signs in a row of $19$ ones, which is $$\binom{19 + 6}{6} = \binom{25}{6}$$ However, we have counted solutions in which one of the $x_k$'s is greater than $9$. Note that at most one $x_k$ can exceed $9$ since $10 + 10 = 20 > 19$.
Suppose that $x_1 \geq 10$. Let $y_1 = x_1 - 10$. Then $y_1$ is a nonnegative integer and \begin{align*} x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + d & = 19\\ y_1 + 10 + x_2 + x_3 + x_4 + x_5 + x_6 + d & = 19\\ y_1 + x_2 + x_3 + x_4 + x_5 + x_6 + d & = 9 \end{align*} This equation has $$\binom{9 + 6}{6} = \binom{15}{6}$$ solutions in the nonnegative integers. Since any of the six $x_k$'s could exceed $9$, the number of nonnegative integers less than $1,000,000$ such that the sum of the digits is less than $20$ is $$\binom{25}{6} - \binom{6}{1}\binom{15}{6}$$ a total that includes the number $0$.
Thus, the number of nonnegative integers less than $1,000,000$ such that the sum of the digits is at least $20$ is $$1,000,000 - \left[\binom{25}{6} - \binom{6}{1}\binom{15}{6}\right]$$