The largest 4-digit mumber is 9999, which has sum of digits 9+9+9+9 = 36,
so to have a sum of digits 34, we have to take 2 away. There are 2 ways
to do that:
1. Take 2 away from 1 of the 9's and the set of digits is {7,9,9,9}.
2. Take 1 away from 2 of the 9's and the set of digits is {8,8,9,9}.
There are 4 arrangements of the digits {7,9,9,9} because there are four
positions for digits: thousands, hundreds, tens, and units. So we can pick
a position for the 7 in C(4,1) = 4 ways. [They are 7999,9799, 9979, and 9997.
There are 6 arrangements of the digits {8,8,9,9} because there are four
positions for digits: thousands, hundreds, tens, and units. So we can pick
a position for the 2 8's in C(4,2) = 6 ways. [They are 8899,8989, 8998,
9889, 9898 and 9988.
So that's 4+6 or 10 ways.
Edwin