# Number of natural numbers below $10^4$ with digits sum $7$ [closed]

If $N$ denotes the number of natural numbers less than $10^{4}$ whose sum of digits is equal to $7$, determine $\frac{N}{120}$

## closed as off-topic by Zev Chonoles, Jennifer, Hurkyl, Namaste, Ken DunaMar 14 '17 at 14:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Zev Chonoles, Jennifer, Hurkyl, Namaste, Ken Duna
If this question can be reworded to fit the rules in the help center, please edit the question.

• 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 9:05
• There are $120$ natural numbers below $10^4$ with digit sum $7$, so the result is $1$ – Peter Mar 14 '17 at 9:20
• Did you arrive at that using the method yiyuan specified? – Saakshya Devat Mar 14 '17 at 9: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 9:21
• Ok, thank you both for your feedback. – Saakshya Devat Mar 14 '17 at 9:29

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.