How many positive integers less than 20180 have a digit sum of 18?
See related problem here .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Define N ( a , b , c , . . . ) is the amount of possibilities of the number pair ( a , b , c , . . . )
Let the number be A B C D E (any digit can be 0)
When A = 0 ,consider ( B + C ) + ( D + E ) = 1 8
If B + C = 0 , D + E = 1 8 ,then N ( B , C ) = 1 , N ( D , E ) = 1 ,so N ( B , C , D , E ) = 1
If B + C = 1 , D + E = 1 7 ,then N ( B , C ) = 2 , N ( D , E ) = 2 ,so N ( B , C , D , E ) = 4
If B + C = 2 , D + E = 1 6 ,then N ( B , C ) = 3 , N ( D , E ) = 3 ,so N ( B , C , D , E ) = 9
...
If B + C = 9 , D + E = 9 ,then N ( B , C ) = 1 0 , N ( D , E ) = 1 0 ,so N ( B , C , D , E ) = 1 0 0
If B + C = 1 0 , D + E = 8 ,then N ( B , C ) = 9 , N ( D , E ) = 9 ,so N ( B , C , D , E ) = 8 1
...
If B + C = 1 8 , D + E = 0 ,then N ( B , C ) = 1 , N ( D , E ) = 1 ,so N ( B , C , D , E ) = 1
So,when A = 0 , N ( B , C , D , E ) = 1 + 4 + 9 + . . . + 1 0 0 + 8 1 + 6 4 + . . . + 4 + 1 = 6 7 0
When A = 1 ,consider ( B + C ) + ( D + E ) = 1 7
If B + C = 0 , D + E = 1 7 ,then N ( B , C ) = 1 , N ( D , E ) = 2 ,so N ( B , C , D , E ) = 2
If B + C = 1 , D + E = 1 6 ,then N ( B , C ) = 2 , N ( D , E ) = 3 ,so N ( B , C , D , E ) = 6
If B + C = 2 , D + E = 1 5 ,then N ( B , C ) = 3 , N ( D , E ) = 4 ,so N ( B , C , D , E ) = 1 2
...
If B + C = 8 , D + E = 9 ,then N ( B , C ) = 9 , N ( D , E ) = 1 0 ,so N ( B , C , D , E ) = 9 0
If B + C = 9 , D + E = 8 ,then N ( B , C ) = 1 0 , N ( D , E ) = 9 ,so N ( B , C , D , E ) = 9 0
...
If B + C = 1 7 , D + E = 0 ,then N ( B , C ) = 2 , N ( D , E ) = 1 ,so N ( B , C , D , E ) = 2
So,when A = 1 , N ( B , C , D , E ) = 2 ( 2 + 6 + 1 2 + . . . + 9 0 ) = 6 6 0
When A = 2 , A B C D E = 2 0 0 7 9 , 2 0 0 8 8 , 2 0 0 9 7 , 2 0 1 6 9 , 2 0 1 7 8 (5 possibilities)
So,there are 6 7 0 + 6 6 0 + 5 = 1 3 3 5 possibilities.