Replace the letters in the diagram with a different number from 0 to 9, such that the sum of the four numbers on all edges are the same, and the sum of the three numbers on all three corners are the same.
A
B C
D E F
G H I J
In other words, A+C+F+J = A+B+D+G = G+H+I+J and
A+B+C = D+G+H = F+I+J.
There are a dozen solutions:
ABCDEFGHIJ
0594378261
0957341628
1574639028
1672398450
1753648209
1769320548
8230679451
8246351790
8327601549
8425360971
9042658371
9405621738
They were produced by the following awk program:
BEGIN {
for (A=0; A<=9; A++)
{ for (B=0; B<=9; B++) if (B!=A)
{ for (C=0; C<=9; C++) if ((C!=A) && (C!=B))
{ for (D=0; D<=9; D++) if ((D!=A) && (D!=B) && (D!=C))
{ for (E=0; E<=9; E++) if ((E!=A) && (E!=B) && (E!=C) && (E!=D))
{ for (F=0; F<=9; F++) if ((F!=A) && (F!=B) && (F!=C) && (F!=D) && (F!=E))
{ for (G=0; G<=9; G++) if ((G!=A) && (G!=B) && (G!=C) && (G!=D) && (G!=E) && (G!=F))
{ for (H=0; H<=9; H++) if ((H!=A) && (H!=B) && (H!=C) && (H!=D) && (H!=E) && (H!=F) && (H!=G))
{ for (I=0; I<=9; I++) if ((I!=A) && (I!=B) && (I!=C) && (I!=D) && (I!=E) && (I!=F) && (I!=G) && (I!=H))
{ J = 45 - (A+B+C+D+E+F+G+H+I)
if ((J!=A) && (J!=B) && (J!=C) && (J!=D) && (J!=E) && (J!=F) && (J!=G) && (J!=H) && (J!=I))
{ if ((A+B+D+G==G+H+I+J) && (A+B+D+G==A+C+F+J) && (A+B+C==D+G+H) && (D+G+H==F+I+J))
{ print A B C D E F G H I J
}
}
}
}
}
}
}
}
}
}
}
}
Edited on December 3, 2003, 11:25 am