### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

- article (11)
- enigma (1,114)
- misc (2)
- project euler (2)
- puzzle (29)
- site news (43)
- tantalizer (29)
- teaser (3)

### Site Stats

- 166,224 hits

Programming Enigma Puzzles

15 May 2017

Posted by on **From New Scientist #2270, 23rd December 2000** [link]

Here is another “magical” Christmas star of twelve triangles, in which can be seen six lines of five triangles (two horizontal and two in each of the diagonal directions). Your task is to place a digit in each of the twelve triangles so that:

• all six digits in the outermost “points” of the star are odd;

• the total of the five digits in each line is the same, and it is the same as the total of the six digits in the points of the star;

• each of the horizontal lines of digits, when read as a 5-digit number, is a perfect square.

What are those two perfect squares?

Thanks to Hugh Casement for providing the source for this puzzle.

[enigma1115]

Advertisements

%d bloggers like this:

We can use the

SubstitutedExpression()solver from theenigma.pylibrary to tackle this problem.This run file executes in 243ms.

Solution:The two squares are 16641 and 50625.16641 = 129².

50625 = 225².

The six odd digits in the point of the star sum to 1+1+1+5+5+5 = 18, as do the digits on the six lines identified in the diagram.

The

ordered()function, recently added to theenigma.pylibrary, just returns its arguments, sorted withsorted(), as atuple().The conditions of the problem don’t require that the two squares are different, so we can use

itertools.product()(or, if we want to remove duplicate solutions that are horizontal reflections,itertools.combinations_with_replacement()).I found two arrangements for the triangle letters (A – L) making up the star ie

% [A, B, C, D, E, F, G, H, I, J, K, L]

% [5, 5, 0, 6, 2, 5, 1, 6, 6, 4, 1, 1]

% [1, 1, 6, 6, 4, 1, 5, 0, 6, 2, 5, 5]