Wendy randomly chooses a positive integer less than or equal to . The probability that the digits in Wendy's number add up to is , where and are relatively prime positive integers. Find .
Problem 1579
Official solution
1. Case 1: 2-digit numbers
We need to find all 2-digit numbers whose digits sum to 10. Listing them:
This gives us a total of 9 numbers.
2. Case 2: 3-digit numbers
We need to find all 3-digit numbers whose digits sum to 10. We can break this down by the hundreds digit:
- If the hundreds digit is 1, the remaining two digits must sum to 9. The valid combinations are:
This gives us 10 numbers.
- If the hundreds digit is 2, the remaining two digits must sum to 8. The valid combinations are:
This gives us 9 numbers.
- If the hundreds digit is 3, the remaining two digits must sum to 7. The valid combinations are:
This gives us 8 numbers.
- If the hundreds digit is 4, the remaining two digits must sum to 6. The valid combinations are:
This gives us 7 numbers.
- If the hundreds digit is 5, the remaining two digits must sum to 5. The valid combinations are:
This gives us 6 numbers.
- If the hundreds digit is 6, the remaining two digits must sum to 4. The valid combinations are:
This gives us 5 numbers.
- If the hundreds digit is 7, the remaining two digits must sum to 3. The valid combinations are:
This gives us 4 numbers.
- If the hundreds digit is 8, the remaining two digits must sum to 2. The valid combinations are:
This gives us 3 numbers.
- If the hundreds digit is 9, the remaining two digits must sum to 1. The valid combinations are:
This gives us 2 numbers.
Summing these, we get:
3. Case 3: 4-digit numbers
We need to find all 4-digit numbers whose digits sum to 10. We can break this down by the thousands digit:
- If the thousands digit is 1, the remaining three digits must sum to 9. The valid combinations are:
This gives us 55 numbers.
- If the thousands digit is 2, the remaining three digits must sum to 8. The valid combinations are:
This gives us 9 numbers.
Summing these, we get:
4. Total number of valid numbers
Summing the valid numbers from all cases, we get:
5. Probability calculation
The total number of positive integers less than or equal to 2020 is 2020. Therefore, the probability that the digits in Wendy's number add up to 10 is:
6. **Finding **
Since the probability is , we have and . Therefore:
The final answer is