This is a tricky question under test-timing. Solving this was a lot of fun!
---
Say, the average of the 3 numbers is "a".
Case 1: All 3 digits are equal to the average of the 3 numbers(a,a,a) -> 9 possible numbers (111, 222, etc.....upto 999)
Case 2: Exactly 2 digits are equal to the average of the 3 numbers(a,a,b) -> Avg = a = \(\frac{(a + a + b) }{ 3}\)
=> b = a.
In other words, if 2 digits are equal to the average of the 3 numbers, then, by default, the third digit is also equal to the average.
i.e., there is no (a,a,b). It boils down to (a,a,a), which we have already counted.
Case 3: Exactly 1 digit is equal to the average of the 3 numbers(b,c,a) -> where a = \(\frac{(b+c) }{ 2}\)
Here, observe that b and c must be different numbers. if b and c are both the same, we will again end up with (b,b,b). Those cases are already counted.
So, let's count the possible (b,c,a)'s.
a = \(\frac{(b+c) }{ 2}\)
Insight: for "a" to be a proper digit (integer), (b+c) must be an even number.
Case 3 ->Sub-Case 1: b and c are two different odd numbers(1,3,5,7,9)
- 5C2 ways of selecting two different odd numbers for b and c
- Once b and c are chosen, a = \(\frac{b+c}{2}\) is fixed. Only 1 possibility
- Once we have a,b, and c, there are 3! different numbers that can be created.
Total = 5C2 x 1 x 3! = 60 possible numbers
Case 3 ->Sub-Case 2: b and c are two different non-0 even numbersWe need to worry about 0 ending up as the left-most digit, which is not allowed, so we can count the cases which include 0, separately. Here, let's focus on the non-0 cases.
(2,4,6,8)
- 4C2 ways of selecting two different even numbers for b and c
- Once b and c are chosen, a = \(\frac{b+c}{2}\) is fixed. Only 1 possibility
- Once we have a,b, and c, there are 3! different numbers that can be created.
Total = 4C2 x 1 x 3! = 36 possible numbers
Case 3 ->Sub-Case 3: One of the 2 numbers (b or c) is 0.Some considerations -> - b and c cannot both be 0. Then, the avg is also 0. 000 is not to be counted.
- 0 can never be the left-most digit (because then the number would not be 3-digit).
- The avg a cannot be 0, because it is derived from the other digits (at least one of them non-0, none of them negative)
So, the only real possibility is ->(b,0,a = \(\frac{(b+0)}{2}\) = \(\frac{b}{2}\))
Given "a" is a digit, b has to be a non-0 even number.
b -> (2,4,6,8)
- 4C1 = 4 ways of selecting b
- Once b is chosen, the other numbers are locked in. The other numbers are b/2 and 0.
- Now, that we have (b,0,b/2), the number of possible numbers is
2 x
2 x
1 (remember to exclude 0 from the left-most digit)
Total = 4C1 x 1 x 2 x 2 = 16 possible numbers.
Final answer: 9 + 60 + 36 + 16 =
121 3-digit positive integers.
---
Harsha