I saw an example of such a problem here already, where the sum of digits desired was 8. I have already done my question using multinomial theorem, by finding out the coefficient of x^18 in $(x^0+x^1+...+x^9)^6$, and the proper answer came (which is 25927). How to solve it using the fact that $x_1+x_2+...+x_6=18$, and hence through $18+5\choose 5$? I observed the fact that I get the term $18+5\choose 5$ in the first way also, but some options get eliminated after that (subtracted). I understand that those are the cases where the digits are something greater than 9, but is there a proper mathematical explanation for it? Thanks in advance.


Well, I think you gave the explanation yourself already: the $18+5\choose 5$ is for any $6$ (ordered!) numbers that add up to $18$, and that includes more cases than having $6$ digits that add up to $18$ .. I am not sure what else you might be looking for in order to explain this.

But maybe this helps ....

In terms of stars and bars: finding the ways in which $6$ numbers add up to $18$, you'd need to put $5$ bars between or on the sides of $18$ stars, e.g


corresponds to the ordering of $6$ numbers $(4,2,0,1,11,0)$, and you can see there are $18+5\choose 5$ ways to put those $5$ bars in those $18+5=23$ positions

However, when it comes to $6$-digit numbers (where a number like $53$ is represented by $000053$), you can't put the bars more than $9$ spots apart, and so there are fewer ways to do that.

  • $\begingroup$ Thank you. I think I was confused with my own explanation (if that even means anything logical). The last paragraph was what I was missing. $\endgroup$ – Arka Seth Apr 3 '19 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.