If $N$ denotes the number of natural numbers less than $10^{4}$ whose sum of digits is equal to $7$, determine $\frac{N}{120}$
-
Hint : Count the number of solutions to $a + b + c + d = 7$ where $0 \le a, b, c, d \le 7$ using the Inclusion-Exclusion principle and the Stars and Bars method. – Yiyuan Lee Mar 14 '17 at 09:05
-
There are $120$ natural numbers below $10^4$ with digit sum $7$, so the result is $1$ – Peter Mar 14 '17 at 09:20
-
Did you arrive at that using the method yiyuan specified? – Saakshya Devat Mar 14 '17 at 09:21
-
To be honest, with a computer program. But it should not be too difficult to do it by hand. – Peter Mar 14 '17 at 09:21
-
Ok, thank you both for your feedback. – Saakshya Devat Mar 14 '17 at 09:29
2 Answers
The problem is the same as count the ways you can distribute 7 balls into 4 urns described here. Setting $n=7$ (number of balls) and $k=4$ number of urns the result becomes:
$$\binom{n+k-1}{n}=\binom{10}{7} = {10!\over7!3!} = {10\cdot 9\cdot 8\over1\cdot 2\cdot3} = 120$$
Then dividing that by $120$ you get $1$.
We have to count the admissible decimal strings in the range $0000-9999$.
To this end we list all partitions of $7$ into $\leq4$ parts and pad them with zeros: $$7000,6100,5200,5110,4300,4210,4111,3310,3220,3211,2221\ .$$ Each of these strings can be permuted in $4$ ways $(7000,4111,2221)$, in $24$ ways $(4210)$, or in $12$ ways (the remaining ones), giving a total of $120$ admissible strings.
I don't think it pays to set up an inclusion-exclusion scheme.
- 232,144