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

20 April 2013

Posted by on **From New Scientist #2600, 21st April 2007**

I have made a number of cards, and have written on them all the nine-digit ninth powers, all the eight-digit eighth powers and so on down to the single-digit first powers. I have arranged these cards to form a ring so that each digit at the right-hand end of one card as seen from the inside of the ring matches that at the left-hand end of its neighbour, going clockwise.

What is the greatest number of digits I can have in the ring?

[enigma1439]

Advertisements

%d bloggers like this:

When this puzzle was originally published I solved it in Perl using an exhaustive search, but it took about 30 minutes to run.

Here’s the search recoded in Python, with a couple of modifications to reduce the run time. It finds a number of maximal length solutions in 2.0s (running under PyPy).

It might be faster to assemble the numbers into chains, and then assemble non-intersecting chains into a ring.

Solution:The maximum number of digits in the ring is 64.