### Random Post

### Recent Posts

### Recent Comments

Jim Randell on Tantalizer 452: Snailspaces | |

Brian Gladman on Enigma 1061: Par is never… | |

Hugh Casement on Enigma 1061: Par is never… | |

Jim Randell on Enigma 1061: Par is never… | |

geoffrounce on Puzzle 47: Digits all wro… |

### Archives

### Categories

- article (11)
- enigma (1,175)
- misc (2)
- project euler (2)
- puzzle (44)
- site news (46)
- tantalizer (48)
- teaser (3)

### Site Stats

- 183,007 hits

Advertisements

This Python code runs in 239ms.

Solution:There are 14 numbers in a maximal length chain.Here’s an example chain of length 14: (121, 105, 529, 903, 324, 406, 676, 666, 625, 528, 841, 153, 361, 171).

Because the chain must form a closed loop of alternating squares and triangular numbers the solution can only be a chain with even length.

But we can find longer sequences with alternating squares and triangular numbers that are of odd length, but when formed into a closed loop two numbers of the same type will be next to each other.

Here’s an example chain of length 17: (561, 144, 496, 676, 666, 625, 528, 841, 171, 121, 153, 361, 105, 529, 903, 324, 465).

When formed into a loop 561 = T(33) and 465 = T(30) will be adjacent.

I wish to challenge the meaning of “cyclical chain”. To me it means following a predetermined cycle (i.e. alternate squares and triangular numbers), not that it has to be “circular”. Anyway, I got a chain 19 numbers long, beginning and ending with triangular numbers – 225 – 528 – 841 – 171 – 121 – 105 – 529 – 946 – 676 – 666 – 625 – 561 – 169 – 903 – 361 – 153 – 324 – 465 – 576. Happy days! (8 October 2014)

The published solution was that there were 14 numbers in the chain, so I think the setter was intending the numbers to be formed into a circle. They probably could have been a bit more explicit in the problem statement.

If you relax the conditions so you’re just looking for an alternating sequence (that doesn’t have to form a closed loop) then 19 is indeed the maximal length you can achieve.