<s>[INST] Number of natural numbers less than million with sum of the digits equal to $12$ Number of natural numbers less than million with sum of the digits equal to $12$
My Try: obviously we need 6 places to filled with digits $0$ to $9$ such that sum of the digits is $12$
so the required number is number of non negative integral solutions of
$$x_1+x_2+x_3+x_4+x_5+x_6=12$$ which is nothing but $\binom{17}{5}$
Is this correct approach?
 [/INST] We seek the number of solutions of the equation in the nonnegative integers
$$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 = 12 \tag{1}$$
subject to the restrictions that $x_k \leq 9$ for $1 \leq k \leq 6$.  
As you determined, if there were no restrictions, equation 1 has
$$\binom{12 + 6 - 1}{6 - 1} = \binom{17}{5}$$
solutions in the nonnegative integers.
Suppose $x_1 > 9$.  Then $x_1' = x_1 - 10$ is a nonnegative integer.  Substituting $x_1' + 10$ for $x_1$ in equation 1 yields 
\begin{align*}
x_1' + 10 + x_2 + x_3 + x_4 + x_5 + x_6 & = 12\\
x_1' + x_2 + x_3 + x_4 + x_5 + x_6 & = 2 \tag{2}
\end{align*}
Equation 2 is an equation with 

 $$\binom{2 + 6 - 1}{6 - 1} = \binom{7}{5}$$

solutions in the nonnegative integers.  By symmetry, there are an equal number of solutions for each of the six variables that could exceed $9$.  Hence, the number of solutions of equation 1 that do not satisfy the restrictions is 

 $$\binom{6}{1}\binom{7}{5}$$

so the number of natural numbers less than a million that have digit sum $12$ is 

 $$\binom{17}{5} - \binom{6}{1}\binom{7}{5}$$

</s>