Author | Message | Time |
---|---|---|
shadypalm88 | How many numbers of n digits exist if the sum of all digits is s? | November 12, 2006, 6:16 AM |
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. | November 18, 2006, 10:12 AM |