Valhalla Legends Archive

Member Forums => Yoni's Math Forum => Topic started by: shadypalm88 on November 12, 2006, 12:16 AM

Title: Problem for Yoni
Post by: shadypalm88 on November 12, 2006, 12:16 AM
How many numbers of n digits exist if the sum of all digits is s?
Title: Re: Problem for Yoni
Post by: Yoni on November 18, 2006, 04:12 AM
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.