Enigmatic Code

Programming Enigma Puzzles

Puzzle 55: A division with all figures wrong

From New Scientist #1106, 8th June 1978 [link]

In the following, obviously incorrect, division sum the pattern is correct, but every single figure is wrong.

The correct division comes out exactly. The digits in the answer are only 1 out, but all the other digits may be incorrect by any amount.

Find the correct figures.



Enigma 1076: Last posts

From New Scientist #2232, 1st April 2000 [link]

George has a small field adjacent to his new house, in which he intends to build an ornamental lake. The field is triangular with sides conveniently 4, 7 and 8 times the length — about 12 feet — of the job lot of fence rails he has bought from the local builders’ merchant. He has set the required 19 posts evenly spaced around the perimeter and built the fence.

To define the lake, George has stretched three lengths of rope, each from one corner post to the last post before the corner (working anticlockwise) on the opposite side of the field. The enclosed triangle will be the lake, the surrounding area grassland. The whole field measures two “ares” — an “are” being a metric unit of area equal to 100 square metres.

What is the area of the lake?


Enigma 434: Going to pot

From New Scientist #1584, 29th October 1987 [link]

My friend Aubrey Shah, who runs a garden centre, was telling me the other day about his new junior assistant.

“I gave him six potted plants to label,” he said. “He got one right — by accident, I’m sure. The label on the geranium belonged to the plant he thought was a begonia. Funny, though — the first three plants I looked at had the right three labels among themselves.” His eyes began to sparkle. “Tell you what, though,” he said. “If I told you what label was on the chrysanthemum, you’d know what was on the dahlia.”

I smiled indulgently. “Go on,” I encouraged him.

“The aster was mislabelled,” he said.

Which plant bore the fuchsia label?


Tantalizer 462: Legs of oak

From New Scientist #1013, 12th August 1976 [link]

A fragment of a prophecy lately unearthed says that the Oxford vs. Cambridge boat race of 1980 will take the usual form (8 oarsmen in each boat and so on) but will end in a tie. So an occupant of each boat will be picked and random and these two will decide the event by a mile race run on foot. This is unlikely to be a cliff-hanger, however, as the chances are 2:1 that exactly one of them will have a wooden leg. Since this is an unmistakeable handicap, Oxford is therefore likely to be the winner, despite having at least one wooden leg in the boat.

An impossible prophecy? Not at all, if you avoid a small catch. Assuming that no one in either boat has two wooden legs, can you work out how many wooden legs there will have to be in the Cambridge boat?


Enigma 1077: Identical square sums

From New Scientist #2233, 8th April 2000 [link]

I have found three examples of a three-digit number that can be the sum of two three-digit perfect squares in two different ways. One particular perfect square contributes to all three of my examples.

Everything stated above about me is also true of both Harry and Tom, but each of us has a different perfect square contributing to all three examples. One of my examples is the same as one of Harry’s, and another of my examples is the same as one of Tom’s.

(1) Which three-digit number is the sum of each pair of squares in the example that I found but neither Harry or Tom found?

[There is a further example of a three-digit number than can be the sum of two three-digit perfect squares in two different ways that none of us found].

(2) Which three-digit number is the sum of each pair of squares in the example that none of us found?


Enigma 433: Double vision

From New Scientist #1583, 22nd October 1987 [link]

Professor Didipotamus had been working on the equation:


in which each letter stood for a single digit and B was a multiple of E.

“Oh dear,” he said, “that has too many solutions. For example: 76 = 493. Or, worse still, if A were 9, we could have 94 = 812 or 96 = 813.”

So saying, he scratched his head and put on his bifocals. To his surprise, the equation on his whiteboard now seemed to read:


“Now that’s the sort of equation I like,” he remarked to a flowering cactus. “It should have only one solution.”

Given that A, B, C, D and E all stand for different digits, that B is a multiple of E, and E is not 1, what number does ABCDE represent?


Puzzle 56: Addition

From New Scientist #1107, 15th June 1978 [link]

In the addition sum below with letters substituted for digits all is not as it should be. Uncle Bungle has been at it again, and one of the letters is incorrect. (Each letter should stand for the same digit wherever it appears and different letters should stand for different digits, and so they do except for the one wrong letter).

Find the mistake, and write out the correct addition sum.


Enigma 1078: Think

From New Scientist #2234, 15th April 2000 [link]

In the two multiplications shown (where both products are identical), all the digits have been replaced by letters and asterisks. Different letters stand for different digits, but the same letter always stands for the same digit whenever it appears. An asterisk can be any digit.

How much is THINK?


Enigma 432: Holiday on the islands

From New Scientist #1582, 15th October 1987 [link]

Alan and Susan recently spent eight days among the six Oa-Oa islands, which are shown on the map as Os.

Enigma 432

Only two of the islands, Moa-Moa and Noa-Noa, have names and hotels. The lines indicate the routes of the four arlines: Airways, Byair, Smoothflight and Transocean.

Alan and Susan started their holiday on the morning of the first day on Moa-Moa or Noa-Noa. On each of the eight days they would fly out to an unnamed island in the morning and then on to a named island in the afternoon and spend the night on that island. They each had eight airline tickets and each ticket was a single one-island-to-the next journey for two passengers. Alan had two Airways and six Byair tickets, while Susan had three Smoothflight and five Transocean tickets. They noticed that whatever island they were on, only one of them would have tickets for the flights out and so they agreed that, each time, that person should choose which airline to use.

Now Alan preferred that they should spend the nights on Moa-Moa, while Susan preferred Noa-Noa. However, they are an inseparable couple. So they each worked out the best strategy for the use of their tickets in order to spend the maximum number of nights on their favourite island.

How many nights did they spend on each island?


Tantalizer 463: Benchwork

From New Scientist #1014, 19th August 1976 [link]

The notice in the magistrates retiring room at Bulchester court reads baldly, “Monday: Smith, Brown, Robinson”. These are the surnames of next Monday’s bench, which will, as always, include at least one man and one married woman. All male magistrates at Bulchester happen to be married. These facts are known to all magistrates.

The court being a large and new amalgamation, Smith, Brown and Robinson know nothing about each other. But Smith, on being told the sex of Brown, could deduce the sex of Robinson and the marital status of both. And Robinson, being told only that Smith could do this, could deduce the sex and marital status of Smith and Brown.

What can you deduce about the trio?


Enigma 1079: Girls’ talk

From New Scientist #2235, 22nd April 2000 [link]

One of the three girls Angie, Bianca and Cindy always tells the truth, one always lies, and the other is unreliable in the sense that a true statement is always followed by a false one and vice versa. Here are some things they just said about themselves:

Angie: The eldest is dishonest. The tallest is unreliable.
Bianca: The youngest is honest. The shortest is unreliable. Angie is taller than me.
Cindy: The youngest is unreliable. The tallest is honest.

What are Cindy’s characteristics? (For example – honest, youngest and mid-height).


Enigma 431: Error in the code

From New Scientist #1581, 8th October 1987 [link]

In the addition sum below, letters have been substituted for digits. It was Uncle Bungle’s intention, when he made this sum up, that the same letter should stand for the same digit wherever it appeared, and that different letters should stand for different digits. Unfortunately, however, he made a mistake, and one of the letters is incorrect.

Write out the correct sum with digits substituted for letters.


Puzzle 57: Football letters for digits

From New Scientist #1108, 22nd June 1978 [link]

Four football teams (ABC and D) are to play each other once. After some of the matches had been played a table giving some details of the numbers won, lost, drawn, and so on was drawn up.

But unfortunately the digits have been replaced by letters. Each letter stands for the same digit (from 0 to 9) whenever it appears and different letters stand for different digits.

The table looks like this:

(Two points are given for a win and one point to each side in a drawn match).

Find the score in each match.


Enigma 1080: Magic product

From New Scientist #2236, 29th April 2000 [link]

A magic square consists of a 3 × 3 array of nine different integers, nought or more, such that the sum of each row, column and main diagonal is the same. The most familiar one is:

If you form the product of each row and add them up you get 8×1×6 + 3×5×7 + 4×9×2 = 225. Similarly if you form the product of each column and add them up you get 8×3×4 + 1×5×9 + 6×7×2 = 225. Remarkably the two numbers will be equal for any magic square, and it is known as the “magic product”.

There is a magic square whose middle entry is a single digit number which equals the sum of the three digits in its magic product.

What is that magic product?


Enigma 430: Let your fingers do the walking

From New Scientist #1580, 1st October 1987 [link]

Enigma 430

My Welsh friend, Dai the dial, has a telephone number consisting of nine different digits and, as you telephone him on my push-button phone illustrated above, you push a sequence of buttons each adjacent (across or down) to the one before.

The digit not used in his number is odd, the last digit of the number is larger than the first, and (ignoring the leading digit if it is zero) the number is divisible by 21.

What is Dai’s number?


Tantalizer 464: Pentathlon

From New Scientist #1015, 26th August 1976 [link]

The Pentathlon at the West Wessex Olympics is a Monday-to-Friday affair with a different event each day. Entrants specify which day they would prefer for which event — a silly idea, as they never agree.

This time, for instance, there were five entrants. Each handed in a list of events in his preferred order. No day was picked for any event by more than two entrants. Swimming was the only event which no one wished to tackle on the Monday. For the Tuesday there was just one request for horse-riding, just one for fencing and just one for swimming. For the Wednesday there were two bids for cross-country running and two for pistol-shooting. For the Thursday two entrants proposed cross-country and just one wanted horse-riding. The Friday was more sought after for swimming than for fencing.

Still, the organisers did manage to find an order which gave each entrant exactly two events on the day he had wanted them.

In what order were the events held?

I don’t think there is a solution to this puzzle as it is presented. Instead I would change the condition for Thursday to:

For Thursday two entrants proposed cross-country and just one wanted fencing.

This allows you to arrive at the published answer.


Enigma 1081: Prime cuts

From New Scientist #2237, 6th May 2000 [link]

My supermarket was offering a discount of £2 off the cost of shopping if the bill exceeded a certain number of pounds. I qualified for the discount though my bill exceeded the minimum required for it by less than £1. My bill, both before and after the discount was applied, was for a prime number of pence.

The same discount offer applied the following week and everything stated above was again true of my new bill. Over the two weeks the total cost of my shopping was an exact number of pounds, prime whether or not you take the discounts into account and less than £30.

How much did each of my two bills amount to before the discounts were applied? Remember, there are 100 pence in a pound.


2017 in review

Happy New Year from Enigmatic Code!

There are now 1,134 Enigma puzzles on the site, along with 35 from the Tantalizer series and 34 from the Puzzle series (and a few other puzzles that have caught my eye). There is a complete archive of Enigma puzzles published between January 1979 to September 1987, and from May 2000 up to the final Enigma puzzle in December 2013, which make up about 63.3% of all the Enigma puzzles published. Of the remaining 654 puzzles I have 152 left to source (numbers 891 – 1042).

In 2017, 105 Enigma puzzles were added to the site (and 30 Tantalizers and 28 Puzzles, so 163 puzzles in total). Here is my selection of the puzzles that I found most interesting to solve over the year:

Older Puzzles (1986 – 1987)

Newer Puzzles (2000 – 2001)

Other Puzzles

I have continued to maintain the enigma.py library of useful routines for puzzle solving. In particular the SubstitutedExpression() solver and Primes() class have increased functionality, and I have added the ability to execute run files, in cases where a complete program is not required. The SubstitutedDivision() solver is now derived directly from the SubstitutedExpression() solver, and is generally faster and more functional than the previous implementation.

I’ve also starting putting my Python solutions up on repl.it, where you can execute the code without having to install a Python environment, and you can make changes to my code or write your own programs (but a free login is required if you want to save them).

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

Enigma 429: Professor Quark

From New Scientist #1579, 24th September 1987 [link]

Professor Quark was standing in a queue at a cheese counter. “I seem to be in a rather stationary state,” he mused out loud. “This queue and my position in it have a special property. You see,” he explained to an imaginary observer, “if one person were to drop out of the queue ahead of me, the number obtained by dividing the number behind me by the number remaining ahead would be an integer or half an integer. If instead a person were to drop out of the queue behind me, then number obtained by dividing the number ahead of me by the number remaining in the queue behind me would also be either and integer of half an integer.”

Bearing in mind that a queue with, say, 3 in front and 4 behind is distinguishable from one with 3 behind and 4 in front, and assuming Quark’s calculations were correct:

(a) How many distinguishable queues satisfy Quark’s observation?

(b) What was the largest number of people, including Quark, that there could have been in the queue?


Puzzle 58: Letters for digits

From New Scientist #1109, 29th June 1978 [link]

In the following division sum each letter stands for a different digit. Rewrite the sum with the letters replaced by digits.