Enigmatic Code

Programming Enigma Puzzles

Enigma 1181: Pandigitals

From New Scientist #2337, 6th April 2002

George has been investigating pandigital numbers, which he defines as 10-digit numbers with no leading zero, containing the digits 0-9 once each. The largest pandigital number is 9876543210. Since it ends in 0 it is clearly divisible by 2 and 5, giving quotients 4938271605 and 1975308642 – both pandigital!

Inspired by this discovery, he set out to list, for each possible multiple, the largest pandigital number which is an exact multiple of another pandigital number. The solutions for 4 and 8 can be found by small-scale number juggling; the others require a more systematic approach.

What is the smallest number in George’s list of largest pandigital multiples?

Thanks to Hugh Casement for providing a complete transcript for this puzzle.


Enigma 331: All change please

From New Scientist #1479, 24th October 1985 [link]

In the following long division sum the figures given have this is common — they are all wrong. The sum comes out exactly.

Enigma 331

Write out the correct long division sum.


Enigma 1182: Recurring decimals

From New Scientist #2338, 13th April 2002

Some fractions expressed as decimals consist of a decimal point followed immediately by a set of digits that recurs ad infinitum: for example 2/37 = 0.054054054…

In this example the digits that form the fraction and the recurring decimal are all different from each other, but there are only six of them (2, 3, 7, 0, 5, 4).

Your task is to find another fraction written in its simplest form that when expressed as a decimal consists of a decimal point followed immediately by a set of digits that recurs ad infinitum. The digits that form the fraction and the recurring decimal must all be different from each other and there must be nine of them.

What is the fraction?


Enigma 330: Enigmatic table

From New Scientist #1478, 17th October 1985 [link]

The four teams Alphas, Betas, Gammas and Deltas are part way through their football season, in which each plays each of the others once. Part of the league table (with the teams in decreasing order) is given below with digits consistently replaced by letters. Three points are awarded for a win and one for a draw.

Enigma 330

There’s only one entry in Alpha’s row — and that’s wrong! It should in fact be lower than the entry implies. Luckily the rest is right.

List the matches played so far and the score in each.


Enigma 1183: Teems of teams

From New Scientist #2339, 20th April 2002

Our local football team consists of BERT, DAVE, FRED, JACK, JOHN, LEON, MARK, MIKE, NICK, PHIL and STAN. The team is in a large league. On match evenings each team plays in a match and by the end of the season each team has played each of the others once.

I’ve kept a note of last season’s results and I’ve counted up the number of matches in which there was a win for one team or the other, and I’ve also counted the rest, which were draws. I’ve then replaced digits consistently with letters, different letters being used for different digits.

How many matches resulted in a win? [The answer is] WIN.

And in how many was there a tie between two teams? [The answer is] TIE.

How many games were played altogether? The answer is one of our player’s names!

Whose name? And how many teams in the league?


Enigma 329: Clear short circuit

From New Scientist #1477, 10th October 1985 [link]

Enigma 325

An n-circuit is a closed path of n different points and n different legs. Every leg runs along a grid-line and every point is a junction of grid-lines. Legs do not overlap, but they may cross.

A clear circuit is one that you cannot make a circuit with just some of the points. Thus the 5-circuit A is not clear. Points 1, 2 and 5 would make a 3-circuit: so would points 3, 4 and 5. But B is clear.

The length of a circuit is just the sum of the lengths of the legs. Thus A has length 7, and B has length 11.

Can you find a clear 12-circuit with a length of 21 (or less)?

A similar problem to Enigma 325.


Enigma 1184: Church-draughtsmanship

From New Scientist #2340, 27th April 2002

My young nephew recently asked me to draw him a church. He gave me a sheet of A4 paper, and I began by drawing a square. I next added an isosceles triangle, using the whole of the top of the square as its base. To the whole of one side of the square I then added a rectangular nave. Of the three shapes, the rectangle occupied the largest area. The four different constituent dimensions were each a whole number of centimetres, these dimensions being the sides of each shape and the vertical height of the triangle. The areas of the three shapes added together produced a total which was perfectly divisible by each of the four dimensions.

What were the overall length and overall height of my church?


Enigma 328: Nine men went to mow

From New Scientist #1476, 3rd October 1985 [link]

Enigma 328

Nine men went to mow, went to mow a meadow. Write “9” in one of the meadows. Eight men left the ninth in the meadow and went through a gate into the next. Write “8” in the meadow they went into. Seven men left the eighth behind and went through a gate. Write “7” in the meadow they went into. Carry on in this way until you have “6”, “5”, “4”, “3”, “2” and “1” duly inscribed in the remaining meadows. You must use a gate each time and never enter the same meadow twice.

That gives you a three-digit number on each of the three lines. Try adding the top number to the middle number and see if they sum to the bottom number. If not, bad luck — you’ll have to sing the song all over again.

When you have got it right, please give the completed grid.


Enigma 1185: Interval music

From New Scientist #2341, 6th May 2002

The relative frequencies of the notes of the diatonic music scale are:

C = 24, D = 27, E = 30, F = 32, G = 36, A = 40, B = 45, C’ = 48.

I recently built a series of oscillators so that I could hear how it sounded, but something went wrong with the wiring, so that I ended with an eight-note keyboard where only two were in the correct places.

However, when I played each key in order from the left, I noticed that the only intervals between adjacent notes were fourths (frequency ratio 4/3 or 3/4), fifths (3/2 or 2/3), or sixths (5/3 or 3/5).

Further, the interval (frequency ratio) between the two notes I did get right was one of these.

(a) If I played the left-hand key, what note letter did it sound?

(b) Could the notes have been arranged according to the same rules and have none in the right place?

(c) Could the notes have been arranged according to the same rules and have had more than two in the right place?


Enigma 327: It all adds up

From New Scientist #1475, 26th September 1985 [link]

Below is an addition sum with letters substituted for digits. The same letter stands for the same digit wherever it appears, and different letters stand for different digits.

Enigma 327

Write out the sum with numbers substituted for letters.


Enigma 1186: Always or never a semi-prime

From New Scientist #2342, 11th May 2002

At snooker a player scores 1 point for potting one of the 15 red balls, but 2, 3, 4, 5, 6 or 7 points for potting one of the 6 “colours”.

Whyte potted his first red, then his first colour, then his second red, then his second colour, and so on until he had potted all 15 reds, each followed by a colour. Since the colours are at this stage always put back on the table after being potted, the same colour can be potted repeatedly.

After Whyte had potted each of the 15 colours his cumulative score called by the referee was always a semi-prime. A semi-prime is the product of two prime numbers; the square of a prime number counts as a semi-prime.

After potting the 15 reds and 15 colours a player tries to pot (in this order) the balls scoring 2, 3, 4, 5, 6 and 7 points. Whyte did so to complete a total “clearance”, but his cumulative score after each of those six pots was never a semi-prime.

What was his final score?

Thanks to Hugh Casement for providing a complete transcript for this puzzle.


Enigma 326: Tombola ups and downs

From New Scientist #1474, 19th September 1985 [link]

We are going to run a tombola at our big local charity ball. We’ve had a particular number of tickets printed, numbered consecutively from 1 upwards. We asked the printer to put “Prize-winner” on all those tickets whose number had its digits increasing from start to finish (e.g. 9, 37, 256, etc), but in error he marked those tickets whose numbers had their digits decreasing from start to finish (e.g. 7, 54, 310, etc). (Single digit numbers were intended to be winners and were printed as winners).

By a great coincidence this meant that there were as many prize-winning tickets as we had wished. But had the number of tombola tickets been any higher that could not have been the case.

How many tickets were there?


2015 in review

Happy New Year from Enigmatic Code!

There are now 923 Enigma puzzles on the site. There is a complete archive of all puzzles published from January 1979 – September 1985 and also from May 2002 – December 2013. Which is about 52% of all Enigma puzzles published in New Scientist, and leaves around 860 puzzles to add to the site.

In 2015 I added 160 Enigma puzzles (as well as a handful of puzzles from other sources). Here’s my selection of the ones I found most interesting to solve programatically this year:

Older puzzles (1984 – 1985)

Newer puzzles (2002 – 2003)

During 2015 I switched to posting puzzles twice a week (on Monday and Friday, with the occasional extra posting on Wednesdays if I had something interesting to post), so there are around 8 years worth of puzzles to go.

Thanks to everyone who has contributed to the site in 2015, either by adding their own solutions (programmatic or analytical), insights or questions, or by helping me source puzzles from back-issues of New Scientist.

Here is the 2015 Annual Report for Enigmatic Code generate by WordPress.

Enigma 1187: Leviticus 19:9-10

From New Scientist #2343, 18th May 2002 [link]

“When you reap the harvest of your land, you shall not reap to the very edges of your field, …, you shall leave them for the poor and the alien: I am the Lord your God.”

The land of Fairfield has put that commandment into its legal code. All the fields of Fairfield are the same size; they are rectangles, 100 metres wide and a whole number of metres long. Each field contains a border strip along each of its four sides. This strip is a whole number of metres wide and is not to be reaped. The width of that strip has been chosen so that exactly half the area of each field is in the strip. I noticed that the digits in the length, in metres, of each field are in decreasing order when read from left to right.

Find the length of each field and the width of each strip.


Enigma 325: Clear thin circuit

notableFrom New Scientist #1473, 12th September 1985 [link]



Enigma 325

An n-circuit is drawn on a triangular grid made up of equilateral triangles. It is a closed path of n different points and n different legs. Every leg runs along a grid-line and every point is a junction of grid-lines. Legs do not overlap, but they may cross.

A clear circuit is one that you cannot make a circuit with just some of the points. Thus the 5-circuit A is not clear. Points 1, 2 and 5 would make a 3-circuit: so would points 3, 4 and 5. But B is clear.

The fatness of a circuit is the area it encloses. Thus A has fatness 5 (measured by the number of little triangles enclosed), and B has fatness 7.

Can you find a clear 9-circuit with a fatness of 9 (or less)?

Happy Christmas from Enigmatic Code!


Enigma 1188: Square roundabout

From New Scientist #2344, 25th May 2002 [link]

I was playing about with my seven-digit-display calculator, showing my numerate nephew a trick or two. I displayed a number on the calculator and he looked at it upside down. After some jottings of his own he declared “I can see a number too, and it’s a perfect square”.

I then doubled my original number and displayed the answer and again he looked at it upside down and did some calculations.

“I can still see a number, and it’s another perfect square”, he said.

Which number did I originally display?


Enigma 324: A week’s work

From New Scientist #1472, 5th September 1985 [link]

As you probably know, Nondag, Ondag, Pondag, Quondag, Rondag, Shondag and Tvondag are the days of the Ruritanian week. But I wonder if you know which is which.

Well, think of the week as starting with Monday. You can get three Ruritanian days right by calling out the alphabetical order above. That does not help much, of course, as you do not know which three. So her is another order which gets three right: Quondag, Ondag, Nondag, Pondag, Rondag, Tvondag, Shondag. And here is another which also gets three right: Tvondag, Quondag, Pondag, Ondag, Nondag, Shondag, Rondag.

That should be enough to go on. What is the fully correct order?


Enigma 1189: Prime performance

From New Scientist #2345, 1st June 2002 [link]

I recently bought a compilation of archive recordings by the Prime Players, issued as a set of three CDs. Each CD has a different playing time of not more than one hour and contains four tracks. Within each CD each track lasts a different prime whole number of minutes, and any combination of three different tracks on that CD lasts a prime whole number of minutes.

For each CD, give its playing time and the length of its longest track.


Enigma 323: A man of letters

From New Scientist #1471, 29th August 1985 [link]

Professor D. O’Phantus does all his calculations in code, with each digit represented by a letter of the alphabet. Each letter always stands for the same digit and each digit is always represented by the same letter. At the end of one of his confusing lectures on “Letter Theory” some examples of calculation remained on the blackboard.

According to the professor:

Enigma 323 - 1

Sadly, the result of another addition:

Enigma 323 - 2

had been wiped out, but when it was multiplied by the result of the previous sum it apparently yielded OMTTOUI.

“This is quite hopeless”, said Magnus Swottus. “How can we do lots of lovely homework if we don’t know what the letters stand for? It might as well be Greek.”

But Goody-Goody Major, unwilling to be done out of his homework, was more philosophical. “We’ll just have to crack old Doodah’s code, and then just think of all the problems open to us? We’ll even be able to invent our own!”

Can you help these young enthusiasts by writing out in order the letters corresponding to the digits from 0 to 9?


Enigma 1190: Triple duel

From New Scientist #2346, 8th June 2002 [link]

In an earlier incarnation, George fought a “duel” with Ernest and Fred. Ernest was a crack shot, 100 per cent certain to hit his target. Fred had a 75 per cent chance and George only 60 per cent. They agreed to fire one shot at a time in rotation, George (the weakest shot) first, then Fred, then Ernest, until two were dead. Each could aim where he pleased.

If each adopted his best strategy, who was most likely to survive and what was his percentage chance of survival?



Get every new post delivered to your Inbox.