Find the total number of 7-digit natural numbers whose digits sum is 20.
Solution: This is not a exactly answer, as well we can use a way to subtracts the cases when exists a digit greater than $9$.
Let $x_1,\cdots, x_7$ the digits.
As well there are ${25\choose 6}$ ways to give us the sums of numbers, but this permits $x_i>9$.
We need to analyze a few cases (or you can abbreviate this if you're awesomely intellectual, I'm not).
$Case~1)$ All the cases (ways) where $x_1>9$ and the others are less than or equal to $9$.
Then you need to write $x_1=9+x_1'$. And why is this a particular case? Because Stars and Bars here admits numbers equal to zero, and in this ways $0$ is permitted.
But see that this case counts ways that is not permitted by our hypothesis, is when$ (x_1,x_i,x_j,\cdots, x_{j+3})=(10,10,0,\cdots,0) $
To calculate the ways it's easy only have that $x_1'+x_2+\cdots +x_7= 11$
Then clearly all the ways are ${16\choose 6} - 6$
$Case~2)$ Some $x_i\neq x_1$ is greater than $9$.
This is only ${15\choose 6} $ but for individual digits, then all the ways are $6 {15\choose 6} $
This give us that the quantity of numbers such that the sum of digits is $20$ are:
$${25\choose 6}-\left({16\choose 6}+6 {15\choose 6}-6\right) $$
Correct