How many natural numbers less than 2017 are there such that the summation of the digits of the number is 5?

100 Views Asked by At

How can I solve this question using combinatorics ? Is the stars and bars method is applicable here ?

3

There are 3 best solutions below

1
On BEST ANSWER

Yes, you can apply Stars and Bars method to count the numbers of the forms $0***$ and $1***$ whose sum of digits is $5$. The case $2***$ can be done by hand: $2003$, $2012$.

For $0***$, count the non-negative integer solutions of $x_1+x_2+x_3=5$.

For $1***$, count the non-negative integer solutions of $x_1+x_2+x_3=4$.

What is the final answer?

0
On

It is, with some handywork. Count the natural numbers between 2000 and 2017 by hand. Then use stars and bars for the numbers between 0 and 999. Then use the stars and bars for numbers between 1000 and 1999: you have a 1 in the thousands field, which means you have 4 left to distribute over the remaining 3 digits.

0
On

The problem can be formulated as: $$d_1+d_2+d_3+d_4=5, \\ 0\le d_1\le 2;\\ 0\le d_2\le 5;\\ 0\le d_3\le 5;\\ 0\le d_4\le 5.$$ Case 1: $d_1=0$: ${5+3-1\choose 3-1}=21$.

Case 2: $d_1=1$: ${4+3-1\choose 3-1}=15$.

Case 3: $d_1=2$: ${3+3-1\choose 3-1}=10$.

Summing the three cases you get: $46$.

However, the numbers above $2017$ (i.e. $2021, 2030, 2102, 2111, 2120, 2201, 2210, 2300$) must be excluded. So, the answer will be $38$.