#math trivia for #June20: #172 has three digits that add to 10. How many numbers 100-999 do?
— Burt Kaliski Jr. (@modulomathy) June 21, 2012
This is one of those problems that gets easier by recursion. In particular, for each of the possible first digits, a, of the three-digit number, we just need to know how many two-digit numbers add to 10-a. (Here, leading zeroes are allowed; the two-digit numbers can have any value between 00 and 99.)
The number of two-digit numbers that add to a sum s, when s is between 1 and 9, equals s+1. Consider the simple case s = 1, which has two possibilities, 10 and 01, and work upward through s = 9, which has ten, 90, 89, …, and 09.
With the first digit a ranging from 1 to 9, the sum, 10-a, ranges from 9 to 1. Thus the total number of three-digit numbers of the appropriate form is 10+9+…+2 = 54.
Note: When I see a formula that goes only as far as 2, I sometimes will ask myself what happened to the 1. In this case, the 1 would correspond to a sum of 0, which would in turn correspond to a first digit of 10, which isn’t possible. If the first digit were allowed to be 0, on the other hand, then the sum of the other two digits would need to be 10. There are nine two-digit numbers with this sum: 91, 82, …, 19. So the answer to the question of how many numbers 1-999 have digits that add to 10 would be nine more than the total given above, i.e., 63.
Exercise for the reader: What sum is the most common for three-digit numbers?