# Arrange numbers to a 6 point star

Arrange the numbers (1,2,3,4,5,6,7,8,9,11,12, and 16) to replace the letters, so every 3 vertices which form a triangle have equal sums.

• Little typo: there's two "B"s in that picture – FrodCube Nov 12 '16 at 10:24
• There ara 8 triangles, all must have equal sums. – Jamal Senjaya Nov 12 '16 at 12:19

Assuming the "B" in the upper right of the diagram is supposed to be an E,

A=1 B=4 C=12 D=5 E=9 F=16 G=7 H=3 I=2 J=11 K=8 L=6 sums=21

is one solution. There are several.

Keeping the "B" as a B

there are no solutions.

An alternative to computing all the sums by hand is using a constraint solving system like SWI-Prolog with clpfd. The program looks similar to the task at hand:

:- use_module(library(clpfd)).

node(N) :- N in 1..16, N #\= 10, N #\= 13, N #\= 14, N #\= 15.

triangle(Nodes) :-
Nodes = [A, B, C, D, E, F, G, H, I, J, K, L],
node(A), node(B), node(C),
node(D), node(E), node(F),
node(G), node(H), node(I),
node(J), node(K), node(L),
all_distinct(Nodes),

A + B + F #= Sum,
B + C + D #= Sum,
D + E + G #= Sum,
G + L + K #= Sum,
K + J + I #= Sum,
I + H + F #= Sum,
A + E + J #= Sum,
C + H + L #= Sum,

F #< B,   % Prevent symmetrical solutions by requiring F
F #< D,   % to be the smallest inside, and B < I.
F #< G,
F #< K,
F #< I,
B #< I.


Running this program produces this:

?- triangle(Solution), label(Solution). Solution = [11, 8, 6, 7, 9, 2, 5, 3, 16, 1, 4, 12] ; Solution = [11, 9, 5, 7, 8, 1, 6, 4, 16, 2, 3, 12] ; Solution = [16, 3, 6, 12, 4, 2, 5, 8, 11, 1, 9, 7] ; Solution = [16, 4, 5, 12, 3, 1, 6, 9, 11, 2, 8, 7] ; 

The set of equations is:

• F + A + B = sum
• B + C + D = sum
• D + E + G = sum
• G + L + K = sum
• K + J + I = sum
• I + H + F = sum
• A + B + J = sum
• C + L + H = sum

Summed up, this is:

2 * (A + B + C + D + E + F + G + H + I + J + K + L) = 8 * sum

Luckily, we already know this sum, which is 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 11 + 12 + 16 (in any order).

So the sum of each triangle must be

21.

Since this sum is a whole number, there might be a solution. Knowing the sum makes it easier to just try some combinations and quickly reject those tries that have a wrong sum in one of the triangles. Using a small Python program reveals that only the following triangles are possible:

 nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 16] for a in nums: for b in nums: for c in nums: if a < b and b < c and a + b + c == 21: print(a,b,c)  And this is the result:  (1, 4, 16) (2, 3, 16) (1, 8, 12) (2, 7, 12) (3, 6, 12) (4, 5, 12) (1, 9, 11) (2, 8, 11) (3, 7, 11) (4, 6, 11) (4, 8, 9) (5, 7, 9) (6, 7, 8) 

Each of the numbers must be part of 2 triangles.

The 16 can be either on an inside node or on an outside one. Only these two can be distinguished topologically. The rest is laborious work, trying out all possibilities.

 16 inside 1+4+16, 1 inside 2+3+16, 2 inside 1+8+12, 8 inside 3+6+12 must be all-outside no triangle fits 6+x+y (-) 1+8+12, 12 inside no triangle fits 3+8+x (-) 1+9+11, 9 inside 3+7+11 must be all-outside 6+7+8, 6 near 9 no triangle fits 6+9+x (-) 6+7+8, 8 near 9 no triangle fits 8+9+x (-) 1+9+11, 11 inside no triangle fits 3+9+x (-) 2+3+16, 3 inside 1+8+12, 8 inside 2+7+12 must be all-outside 5+7+9, 5 near 8 no triangle fits 5+8+x (-) 5+7+9, 9 near 8 no triangle fits 8+9+x (-) 1+8+12, 12 inside 2+8+11 must be all-outside no triangle fits 11+x+y (-) 1+9+11, 9 inside 2+8+11 must be all-outside 6+7+8, 6 near 9 no triangle fits 6+9+x (-) 6+7+8, 7 near 9 5+7+9 is forced 4+5+12 is forced (+++ solution) 1+9+11, 11 inside no triangle fits 2+9+x (-) 1+4+16, 4 inside 2+3+16, 2 inside 1+8+12, 8 near 2 2+8+11 is forced no triangle fits 11+x+y (-) 1+8+12, 12 near 2 2+7+12 is forced 5+7+9, 5 inside no triangle fits 3+12+x (-) 5+7+9, 9 inside no triangle fits 8+9+x (-) 6+7+8, 6 inside no triangle fits 6+8+x (-) 6+7+8, 8 inside no triangle fits 8+8+x (-) (here I forgot to check 2+8+11, which leads to another solution) 2+3+16, 3 inside 3+6+12, 6 inside 1+8+12 is forced no triangle fits 8+x+y (-) 3+6+12, 12 inside no triangle fits 12+x+y (-) 16 outside 1+4+16 all-outside 2+3+16, 2 near 1 2+7+12, 7 inside no triangle fits 1+7+x (-) 2+7+12, 12 inside 1+8+12 is forced no triangle fits 8+x+y (-) 2+8+11, 8 inside 1+8+12 is forced no triangle fits 12+x+y (-) 2+8+11, 11 inside 1+9+11 is forced 5+7+9, 5 inside 6+7+8 is forced 3+6+12 is forced (+++ solution) 5+7+9, 7 inside no triangle fits 4+7+x (-) 2+3+16, 3 near 1 3+6+12, 6 inside no triangle fits 1+6+x (-) 3+6+12, 12 inside 1+8+12 is forced no triangle fits 8+x+y (-) 2+3+16 all-outside 1+4+16, 1 near 2 1+8+12, 8 inside 2+8+11 is forced no triangle fits 11+x+y (-) 1+8+12, 12 inside 2+7+12 is forced 5+7+9, 5 inside no triangle fits 3+5+x (-) 5+7+9, 9 inside no triangle fits 3+9+x (-) 1+9+11, 9 inside no triangle fits 2+9+x (-) 1+9+11, 11 inside 2+8+11 is forced 6+7+8, 6 inside 3+6+12 is forced 4+12+5 is forced (+++ solution) 6+7+8, 7 inside no triangle fits 6+9+x (-) 1+4+16, 4 near 2 1+8+12, 8 inside no triangle fits 3+8+x (-) 1+8+12, 12 inside 3+6+12 is forced no triangle fits 6+x+y (-) 1+9+11, 9 inside no triangle fits 3+9+x (-) 1+9+11, 11 inside 3+7+11 is forced 6+7+8, 6 inside no triangle fits 2+6+x (-) 6+7+8, 8 inside no triangle fits 6+9+x (-) 

So after all, there are threefour topologically unique solutions.