Pedrinho wrote all the integers between 100 and 999 whose sum of digits is 12. For example, the numbers 129 and 750 appear among the numbers written.

a) How many of the written numbers have only two equal digits?

b) How many of the written numbers are formed only by odd digits?
Solution

a) The digit 1 cannot be repeated because it is not possible to write 12 as a sum of the form $1+1+x$ where $x$ is a digit; indeed, since $x$ is at most 9, this sum will be at most 11. The digit 4 also cannot be repeated, as in this case the number would have to be 444, which has three identical digits and does not comply with the statement. Finally, the digits 7, 8, and 9 cannot be repeated, as in this case the sum of the digits would exceed 12. Therefore, the repeated digit can only be 2, 3, 5, or 6. With 2, 3, and 5, we can form 9 numbers: 228, 282, 822, 336, 363, 633, 552, 525, and 255. With the digit 6, we can form 2 numbers: 606 and 660. Therefore, the total number of numbers written is $9+2=11$.

b) The sum of three odd numbers is an odd number. Since 12 is even, we see that it is impossible to find three odd digits whose sum is 12. Therefore, none of the numbers written have all three digits odd.