How many combinations of numbers are possible keeping the sum of its digits as a constant.
My problem is like this :-
How many numbers are possible keeping the sum = 9 between 9 and 9000 ? ie,
0 0 0 9
0 0 1 8
0 0 2 7
0 0 3 6
0 0 4 5
.
.
.
1 0 0 8
1 0 1 7
.
.
.
8 0 0 1
.
.
9 0 0 0
Any suggestions ?
Best Answer
Because your sum can be stored in a single digit, this is akin to distributing 9 indistinguishable balls among 4 distinguishable baskets ((9+4-1) over 9).