How many decimal integers below 10^20 exist having sum of their digits less than 4?
We can consider 20digit numbers with leading zeros allowedjust lop off any leading zeros for the final result, as there's still a 1to1 correspondence of numbers with leading zeros and a set of numbers with leading blanks.
Now if we know what the possible combinations of nonzero digits are, we can arrange them in the various positions.
The nonzero digits could be:
1
11, 2
111, 12, 3
These are the 6 possibilities. How many placement possibilities are for each of these combinatinos?
1: 20
11: C(20,2)= 190
2: 20
111: C(20,3)= 1140
12: P(20,2)= 380
3: 20
20+190+20+1140+380+20 = 1770
If we count zero, we can add 1 to the total.

Posted by Charlie
on 20171106 18:04:58 