Sunday Times Teaser 2726 – Christmas Star
by David Buontempo
I wanted to place the digits 1 to 10 on the points of a Christmas star where its five lines cross or join in such a way that the sums of the four digits on each of its lines were the same. I couldn’t do this so I used the digits 1 to 9 instead with one digit used twice. One line in the result did not include the repeated digit.
What were the four numbers on this line?
One Comment
Leave one →

brian gladman permalink1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950from itertools import permutations# Organise the variables in the Christmas Star thus:## A# E F G B# J H# I# D C## These sums are hence all equal (to, say, S):## A + C + G + H = B + D + H + I = C + E + I + J =# D + A + J + F = E + B + F + G = S## Adding these and using N for the duplicated digit we have:## 5.S = 2.(A + ... + J) where A .. J are in (1, ..., 9, N), so# 5.S = 2.(45 + N) > S = 18 + 2.N / 5 > N = 5 and S = 20## F, G, H, I and J can now be expressed in terms of A, B, C, D, E:## F = 10  B + C  D, G = 10  C + D  E, H = 10  D + E  A,# I = 10  E + A  B, J = 10  A + B  C# the digits to be useddigits = sorted(tuple(range(1, 10)) + (5,))# a set for storing solutionssol = set()# choose the five digits for the outer ringfor otr in permutations(digits, 5):# remove rotated and reflected solutiuonsif otr[0] == min(otr) and otr[1] < otr[4]:# now compute the values in the inner ringinr = tuple((10  otr[(i + 1) % 5] + otr[(i + 2) % 5] otr[(i + 3) % 5]) for i in range(5))# and check that all the digits are usedif sorted(otr + inr) == digits:# compile the values on the five lineslines = tuple((otr[i], otr[(i + 2) % 5], inr[(i + 1) % 5],inr[(i + 2) % 5]) for i in range(5))# and find the line on which five is absentl = [sorted(x) for x in lines if 5 not in x]sol.add((otr, inr, tuple(l[0])))# output the solutionsfor otr, inr, lne in sorted(sol):print('outer {}, inner {} > {}'.format(otr, inr, lne))