# Is it possible to put the numbers into circles?

This topic is motivated by the trolley813's answer on my question.

Question. Is it possible to put the numbers $$1,2,3,...,23$$ in circles so that the sum of the four numbers on $$9$$ sides of $$3$$ large triangles give the same sum?

Edit. All numbers should be used one time.

My attempt is:

The total sum is $$1+2+...+23=276$$, but $$13$$ numbers (yellow and blue circles) are totalled for each of the sides twice.

The possible sum of $$4$$ numbers in each side is $$276 : 4 = 69$$, if one takes the minimal number $$1$$ and add three maximal numbers $$21, 22, 23$$, then $$1 + 21 + 22 + 23 = 67 < 69$$.

Also it is known that $$276 \mod 9 = 6$$. Now I do not know is it possible to decrease the sum of $$4$$ numbers on each side from $$69$$?

• I've ran a computer search and found many solutions for sides that sum to $44,45,46,47,48,49,50,51,52$, so far. Commented Jan 19, 2020 at 14:11
• What are up and down boundary of sum?
– Nick
Commented Jan 19, 2020 at 14:13
• I'm not sure, I've ran a simple brute force search for some of the possible combinations only. There could still be solutions with $\lt 44$ and $\gt 52$ sums. Commented Jan 19, 2020 at 14:14
• The upper and lower bounds are 42 and 54 respectively, as shown in both my and Michał Wójcik's answers. The only remaining part is if solution with 43 and 53 do actually exist. Commented Jan 19, 2020 at 20:57

Here is a solution with minimal side-sum:

side sum = 42

This was found by brute-force.

The code below will traverse between the bounds as identified by trolley813 and prints a solution with each side-sum (42 & 54 take a while but the rest are much faster). The output solutions are in row-major order.

from itertools import combinations, permutations

def iterSolutions(sideSum):
Q = set(list(range(1, 24)))
for A in combinations(range(1, 24), 4):
if sum(A) != sideSum:
continue
Q1 = Q.difference(A)
for a, d, b, c in list(permutations(A))[::2]:
for B in combinations(Q1, 3):
if a + sum(B) != sideSum:
continue
Q2 = Q1.difference(B)
for g, e, f in list(permutations(B))[::3]:
for h, i in combinations(Q2, 2):
if d + h + i + g != sideSum:
continue
Q3 = Q2.difference((h, i))
for D in combinations(Q3, 3):
if h + sum(D) != sideSum:
continue
Q4 = Q3.difference(D)
for j, k, l in permutations(D):
for E in combinations(Q4, 2):
if j + i + sum(E) != sideSum:
continue
Q5 = Q4.difference(E)
for m, n in permutations(E):
for o, p in combinations(Q5, 2):
if l + o + p + n != sideSum:
continue
Q6 = Q5.difference((o, p))
for G in combinations(Q6, 3):
if o + sum(G) != sideSum:
continue
Q7 = Q6.difference(G)
for q, r, s in permutations(G):
for H in combinations(Q7, 2):
if q + p + sum(H) != sideSum:
continue
v, w = Q7.difference(H)
for t, u in permutations(H):
if s + v + w + u == sideSum:
yield (a, b, e, c, j, f, d, h, i, g, k, q, m, l, o, p, n, r, t, s, v, w, u)

def main():
lowerBound = 42
upperBound = 54
for sideSum in range(lowerBound, upperBound + 1):
print(sideSum)
for solution in iterSolutions(sideSum):
print(solution)
break

if __name__ == "__main__":
main()


Results:

42
(1, 15, 12, 23, 4, 22, 3, 13, 19, 7, 17, 5, 10, 8, 11, 14, 9, 20, 21, 6, 16, 18, 2)
43
(1, 17, 18, 23, 4, 21, 2, 16, 22, 3, 9, 8, 11, 14, 10, 13, 6, 20, 15, 5, 19, 12, 7)
44
(1, 18, 19, 23, 4, 21, 2, 17, 22, 3, 7, 6, 13, 16, 8, 15, 5, 20, 12, 10, 9, 14, 11)
45
(1, 19, 20, 23, 4, 21, 2, 18, 22, 3, 6, 10, 14, 17, 7, 16, 5, 15, 8, 13, 9, 12, 11)
46
(1, 20, 22, 23, 3, 4, 2, 7, 18, 19, 15, 14, 17, 21, 6, 11, 8, 10, 9, 16, 5, 13, 12)
47
(1, 21, 22, 23, 7, 4, 2, 6, 19, 20, 18, 17, 9, 16, 5, 14, 12, 10, 3, 15, 8, 11, 13)
48
(1, 22, 21, 23, 17, 6, 2, 7, 19, 20, 8, 14, 3, 16, 11, 12, 9, 13, 4, 10, 5, 15, 18)
49
(1, 22, 21, 23, 19, 7, 3, 8, 18, 20, 9, 16, 2, 13, 11, 15, 10, 5, 4, 17, 6, 12, 14)
50
(1, 4, 21, 23, 20, 11, 22, 5, 6, 17, 12, 16, 9, 13, 8, 14, 15, 7, 2, 19, 3, 10, 18)
51
(5, 1, 16, 23, 21, 19, 22, 8, 10, 11, 7, 18, 6, 15, 9, 13, 14, 4, 3, 20, 2, 12, 17)
52
(22, 6, 17, 23, 13, 2, 1, 19, 21, 11, 4, 15, 8, 16, 12, 14, 10, 7, 3, 18, 5, 9, 20)
53
(22, 1, 14, 23, 19, 4, 7, 12, 21, 13, 5, 16, 3, 17, 11, 15, 10, 8, 2, 18, 6, 9, 20)
54
(23, 1, 17, 9, 22, 2, 21, 6, 15, 12, 10, 18, 3, 16, 11, 13, 14, 5, 4, 20, 7, 8, 19)

• Thanks! I've updated my answer since it had an error in computation, actual lower and upper bounds are 42 and 54 respectively (if you swap 1 with 23, 2 with 22, 3 with 21 etc. in your solution, then you can get a solution with sum = 54). Commented Jan 19, 2020 at 20:49

A partial answer based on both my own's answer to the original question and Steve's comments on it:

Let $$W$$ be sum of the 10 white numbers, and $$C$$ the sum of 13 coloured numbers (blue and yellow). We know that $$W+C=276$$ and $$W+2C=9S$$, where $$S$$ is the sum of one side. But since the 2 sides completely consist of coloured numbers, we can safely say that $$C\geqslant2S+15$$ (since the 5 remaining blue numbers cannot be less than $$1,2,3,4,5$$, which sum to 15). So, we get $$9S=W+2C=276+C\geqslant276+2S+15=2S+291 \rightarrow 7S\geqslant291 \rightarrow S\geqslant42$$. By noticing that replacing each number $$x$$ with $$24-x$$ (in a valid solution) also leads to a valid solution, we have $$S$$ replaced with $$96-S$$. Since necessarily $$96-S\geqslant42$$, we get $$S\leqslant54$$ (fixed an error: initially the bounds were 43 and 53 respectively, due to the error in computation - literally dividing 291 by 7)

• Not me actually! Try @Steve...
– Stiv
Commented Jan 18, 2020 at 9:46
• @Stiv Oh, sorry! Fixing Commented Jan 18, 2020 at 9:50
• @trolley813, your partial answer is analytical. Could you add some details/conditions how to decrease the number of combinations and permutations?
– Nick
Commented Jan 20, 2020 at 9:32

With branch-and-bound algorithm wrote in Python, I found couple of solutions with the highest possible sum of side (inspired with trolley813's partial answer). One of them is here:

Accually, the maximum edge sum is 54 because:
$$9S=W+2C=276+C\leqslant276+2S+105=2S+381 \rightarrow 7S\leqslant381 \rightarrow S\leqslant54.43$$.
Due to fact that the maximum sum of the remaining 5 blue circles is:
$$19+20+21+22+23=105$$.

The numbers in the circles on the long sides of the three triangles all add up to 43.

• How you find the 43?
– Nick
Commented Jan 19, 2020 at 1:36
• @Nick. I did it with combinatorics, permutations and by grouping the numbers. Commented Jan 19, 2020 at 1:44