Code:
I noticed the middle number e cannot be 5, below is the prove.
Prove by looking at the computer solutions does not count
If you like to prove it yourself, don't peek ...
s = a + b + c
s = e + d + c
s = e + f + g
s = i + h + g
add all of above, note that a+b+c+d+e+f+g+h+i = (1+9)(9)/2 = 45
4s = 45 + c + e + g
Prove by contradiction: assume e = 5
4s = 50 + c + g
min(50 + c + g) <= 4s <= max(50 + c + g)
53 <= 4s <= 67
Possible s = 14, 15, 16
For s = 14, c+g = 4s - 50 = 6 = 2 + 4 (only possibility)
d = s-e-c = 9-c = 7 (only possibility)
f = s-e-g = 9-g = 7 (only possibility) --> impossible to have s = 14
For s = 15, c+g = 4s - 50 = 10
c + d = s - e = 10 --> imply d = g --> impossible to have s = 15
For s = 16, c+g = 4s - 50 = 14 = 6 + 8 (only possibility)
d = s-e-c = 11-c = 3 (only possibility)
f = s-e-g = 11-g = 3 (only possibility) --> impossible to have s = 16
No solution for e = 5
QED