Wouldn't the simplest non-bruteforce method for calculating number of ways to get

all the sums be to use generating functions?

g

_{1}=x+x

^{2}+x

^{3}+x

^{4}+x

^{5}+x

^{6}+x

^{7}+x

^{8}+x

^{9}g

_{2}=1+x+x

^{2}+x

^{3}+x

^{4}+x

^{5}+x

^{6}+x

^{7}+x

^{8}+x

^{9}g

_{3}=1+x+x

^{2}+x

^{3}+x

^{4}+x

^{5}+x

^{6}+x

^{7}+x

^{8}+x

^{9}g

_{4}=1+x+x

^{2}+x

^{3}+x

^{4}+x

^{5}+x

^{6}+x

^{7}+x

^{8}+x

^{9}g

_{5}=1+x+x

^{2}+x

^{3}+x

^{4}+x

^{5}+x

^{6}+x

^{7}+x

^{8}+x

^{9}where the coefficient of x

^{j} in g

_{i} is the number of ways of having the number j appear in the i'th digit.

f=g

_{1}*g

_{2}*g

_{3}*g

_{4}*g

_{5}=(x(1-x

^{9})/(1-x))*((1-x

^{10})/(1-x))*((1-x

^{10})/(1-x))*((1-x

^{10})/(1-x))*((1-x

^{10})/(1-x))

=(1/(1-x))

^{5}*x*(1-x

^{9})(1-x

^{10})(1-x

^{10})(1-x

^{10})(1-x

^{10})

=(1/(1-x))

^{5}(x-x

^{10})(1-4x

^{10}+6x

^{20}-4x

^{30}+x

^{40})

=(1/(1-x))

^{5}(x-x

^{10}-4x

^{11}+4x

^{20}+6x

^{21}-6x

^{30}-4x

^{31}+4x

^{40}+x

^{41}-x

^{50})

=(sum

_{k}(C(k+5,5)*x

^{k}))(x-x

^{10}-4x

^{11}+4x

^{20}+6x

^{21}-6x

^{30}-4x

^{31}+4x

^{40}+x

^{41}-x

^{50})

where C(n,r) = n!/((n-r)! r!)

From here we can see that the coefficient of x

^{j} = C(j+4,5) - C(j-5,5) - 4C(j-6,5) + 4C(j-15,5) + 6C(j-16,5) - 6C(j-25,5) - 4C(j-26,5) + 4C(j-35,5) + C(j-36,5) - C(j-45,5). This should be the same as the number of 5-digit numbers that has a sum of digits = j. This is clearly true for j=1, and with a little effort it gives the clearly

wrong answer of 136511 when j=45 (Can't accuse me of trying to hide my mistake

). I'm too tired to find my mistake right now, but the idea is there, at any rate. I still maintain that the simplest non-bruteforce method for getting ALL of them is via generating functions, though.

Of course, you could expand f directly by multiplying the g's as originally given. But that would be almost as much work as the original problem...