### 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

5 September 2014

Posted by on **From New Scientist #2454, 3rd July 2004**

George drew an equilateral triangle, 3 units each side, divided into unit grid triangles, and asked his son how many triangles of all possible integer dimensions he could see in the diagram.

“Thirteen, Dad.”

“Correct,” said George, “I have now defined the ET function, which stands for Embedded Triangles. For any positive integer the ET function is the number of equilateral triangles of all possible integer sizes and orientations which are formed by the grid lines in an equilateral triangle of the given length of side. Hence ET(3) is 13.

George then drew several integer sided equilateral triangles of different sizes, each divided into unit grid triangles.

“Can you see anything interesting about these, son?”

“Yes, Dad. The ET function of the largest is the sum of the ET functions of the others.”

“Right again. And no smaller triangle can be the largest of such a group.”

What are the lengths of the sides of the triangles?

**Note:** I am waiting for a phone line to be connected at my new house, so I only have sporadic access to the internet at the moment.

[enigma1296]

Advertisements

%d bloggers like this:

This Python program works by counting the triangles. It runs in 37ms.

Solution:The triangles have sides of length 3, 4, 6 and 7.There is only one way to to pick the triangles for the case of ET[7] = 118.

The next case happens at ET[10] = 315, and there are three sets of triangles that can be chosen:

ET[10] = ET[4] + ET[7] + ET[8]

ET[10] = ET[2] + ET[4] + ET[5] + ET[9]

ET[10] = ET[1] + ET[2] + ET[3] + ET[5] + ET[6] + ET[8]

The sequence ET[n] is A002717 in OEIS. [ http://oeis.org/A002717 ]

So we could just use the following function to compute ET[n]: