**From New Scientist #2542, 11th March 2006** [link]

Joe placed five numbered counters in a circle as shown. All Penny had to do was repeat the process for the inner circle with five similarly numbered counters so that no two adjacent counters would have the same number and, when the pairs of adjacent counters (shown joined by a line) were listed, no two pairs would be the same.

Penny soon gave up, saying that Joe should have placed a higher number of counters in the outer circle. Joe did and Penny solved the puzzle. Penny wrote down her solution as a multi-digit number formed by all the digits on the counters in order (a b c d e …).

What is the smallest number Penny could have written?

I couldn’t find a source for this puzzle online, but the nice people at the Reference Department at **Bristol Central Library** were able to find a physical copy of the magazine for me.

I have also enabled ratings for puzzles to allow contributors to the site to rate puzzles on a scale of 1 to 5 stars. Look for the “**Rate this:**” section below the puzzle statement.

[enigma1382]

### Like this:

Like Loading...

In this Python 3 program I use a

dict()to keep track of the pairs of numbers that have been used. I could have encapsulated this code into a class. The code generates the numbers in the inner in numerical order, but I look for the smallest possible composite number usingmin()in case we end up with more than 9 counters. This code runs in 53ms.Solution:The smallest number Penny could have written is 35728416.