3 digit numbers whose one digit is the average of the other two

1.3k Views Asked by At

Question: How many three-digit numbers are composed of three distinct digits such that one digit is the average of the other two?

How can this be solved with an arithmetic sequence?

I can see that any two digits must be same parity to produce the even sum. Also any two of the digits must be divisible by $2$. if $\overline{abc}$ is the digit, $a+b=2c$ and doing that for all three digits gives three equations. Thats as far as I can get.

2

There are 2 best solutions below

0
On

Just for curiosity, I solved this problem programmatically and there are 112 numbers (out of 900) that follow this rule. I am posting the results here so that it can inspire and help with other answers:

1 0 2
1 2 0
1 2 3
1 3 2
1 3 5
1 4 7
1 5 3
1 5 9
1 7 4
1 9 5
2 0 1
2 0 4
2 1 0
2 1 3
2 3 1
2 3 4
2 4 0
2 4 3
2 4 6
2 5 8
2 6 4
2 8 5
3 0 6
3 1 2
3 1 5
3 2 1
3 2 4
3 4 2
3 4 5
3 5 1
3 5 4
3 5 7
3 6 0
3 6 9
3 7 5
3 9 6
4 0 2
4 0 8
4 1 7
4 2 0
4 2 3
4 2 6
4 3 2
4 3 5
4 5 3
4 5 6
4 6 2
4 6 5
4 6 8
4 7 1
4 8 0
4 8 6
5 1 3
5 1 9
5 2 8
5 3 1
5 3 4
5 3 7
5 4 3
5 4 6
5 6 4
5 6 7
5 7 3
5 7 6
5 7 9
5 8 2
5 9 1
5 9 7
6 0 3
6 2 4
6 3 0
6 3 9
6 4 2
6 4 5
6 4 8
6 5 4
6 5 7
6 7 5
6 7 8
6 8 4
6 8 7
6 9 3
7 1 4
7 3 5
7 4 1
7 5 3
7 5 6
7 5 9
7 6 5
7 6 8
7 8 6
7 8 9
7 9 5
7 9 8
8 0 4
8 2 5
8 4 0
8 4 6
8 5 2
8 6 4
8 6 7
8 7 6
8 7 9
8 9 7
9 1 5
9 3 6
9 5 1
9 5 7
9 6 3
9 7 5
9 7 8
9 8 7

The program was written in C++:

#include <iostream>

int main() {
    int count = 0;
    int success = 0;

    for (int i = 100; i <= 999; i++) {
        const int digit3 = i % 10;
        const int digit2 = i/10 % 10;
        const int digit1 = i/100 % 10;

        if (digit1 != digit2 && digit2 != digit3 && digit1 != digit3) {
            const float avg1 = (digit1 + digit2) / 2.f;
            const float avg2 = (digit2 + digit3) / 2.f;
            const float avg3 = (digit1 + digit3) / 2.f;
            if (avg1 == digit3 || avg2 == digit1 || avg3 == digit2) {
                success++;
                std::cout << digit1 << ' ' << digit2 << ' ' << digit3 << '\n';
            }
        }
        count++;
    }
    std::cout << success << '/' << count << '\n';
}
0
On

Can be done by simple trial and error (Note that plus sign is only used to distinguish the triplets of digits that can be used to form the desired number)

$0+2,4,6,8+1,2,3,4$

$1+3,5,7,9+2,3,4,5$

$2+4,6,8+3,4,5$

$3+5,7,9+4,5,6$

$4+6,8+5,6$

$5+7,9+6,7$

$6+8+7$

$7+9+8$

In total we get 20 possible triplets of digits that can be permuted in $3!=6$ different ways over 3 possible places. This gives us $20×6=120$

However, the numbers formed from the 4 triplets with $0$, ie, $0+2,4,6,8+1,2,3,4$, will have $2/6$ permutations in which the unit digit is the one $=0$. But this can't be since the numbers is a 3 digit number.

Hence we will have to subtract $4×2=8$ from $120$ to give our final answer of $112$ which matches the data provided in the other answer