### Random Post

### Recent Posts

### Recent Comments

### Archives

### Categories

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

### Site Stats

- 168,282 hits

Programming Enigma Puzzles

21 July 2017

Posted by on **From New Scientist #1556, 16th April 1987** [link]

I entered the jungle clearing and found, at the centre, six stones numbered 1, 2, 3, 4, 5, 6. My native guide demonstrated the ancient ritual which was enacted on that site.

First I had to arrange the stones in any order I wished, so I put them as 421365. I then noted the number on the first stone — all counting is from the left — is was 4, and so I picked up the fourth stone and placed it at the right hand end. I obtained 421653. Next, I looked at the second stone, a 2, and moved the second stone to the end, to give 416532. I repeated the procedure for the third stone to give 416532, and then for the fourth, fifth and sixth stones, to give successively, 416523. 465231, 652314. The final arrangement was called the result of the ritual.

Just then the high priestess, Sarannah, entered. She arranged the stones in a certain order, carried out the ritual and obtained the result 314625. My guide explained that the arrangement Sarannah started with was the result of applying the ritual to a very special arrangement, which she could not tell me.

What was the arrangement that Sarannah started with?

[enigma406]

Advertisements

%d bloggers like this:

This code considers the result of applying the ritual to every possible arrangement of stones, and builds a “reverse map” which tells us what arrangements will lead to a particular outcome. We can then use the reverse map to solve the problem. It runs in 35ms.

Solution:Sarannah started with 623514.The “special arrangement” must be one of 152436, 154326, 524316, 543216 or 546321, but we can’t tell which one.

But without this fact Sarannah could have started with 263451 or 632514, but neither of these can be the result of applying the ritual to any arrangement of the stones, so they can be eliminated.