• Welcome to Valhalla Legends Archive.
 

Problem for Yoni

Started by shadypalm88, November 12, 2006, 12:16 AM

Previous topic - Next topic

shadypalm88

How many numbers of n digits exist if the sum of all digits is s?

Yoni

http://mathworld.wolfram.com/BallPicking.html

The answer is in the multiset coefficient:
(s + n - 1) choose (n - 1)
or:
(s + n - 1)! / ( (n - 1)! s! )

This does not use the fact that each digit must be between 0 and 9.
i.e., it simply finds the amount of different (nonnegative integer) solutions to x_1 + x_2 + .. + x_n = s.
For limiting each digit to 0-9, look into generating functions.