Enigmatic Code

Programming Enigma Puzzles

Enigma 1057: Recycled change

From New Scientist #2213, 20th November 1999

The denominations of coins currently in circulation are 200, 100, 50, 20, 10, 5, 2 and 1p. When we pay for an item we quite often exchange fewer coins when change is given than when the exact amount is offered. For instance, an item costing 91p would require at least four coins (50+20+20+1) for the exact amount, but the purchase can be made with the exchange of only three coins (100+1–10) if change is given.

Harry, Tom and I each bought an identical item that cost less than 100p. None of us offered the exact amount, but we each exchanged fewer coins than if we had done so. In fact, we each exchanged the minimum number of coins possible for an item of that price even though we each offered a different amount of money in payment.

I paid first, and Harry and Tom each included a different one of the coins I had received in my change among the coins that they offered.

How much did the item cost?



Enigma 452: Figure out these letters

From New Scientist #1603, 10th March 1988 [link]

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

Write the sum out with numbers substituted for letters.


Puzzle 46: I lose my specs

 From New Scientist #1097, 6th April 1978 [link]

In the division sum below letters stand for different digits. But unfortunately I did not have my specs with me when I copied it out and discovered later that I had made a mistake. One letter was wrong on one of the occasions when it appeared.

Find the incorrect letter, and rewrite the sum with the letters replaced by digits.


Enigma 1058: A row of colours

From New Scientist #2214, 27th November 1999

Pusicatto has been asked by a family to paint a picture consisting of a row of squares, which each square either red or green. Each member of the family has expressed a wish for something they would like to appear in the picture. For example, Mum asked for G??R?G, by which she meant that, somewhere in the row, there should be a green square, then two squares that could be of either colour, then a red square, then a square of either colour, and then a green square, without any other squares coming between them. Dad asked for G?R?R. The children’s requests were:

Kathy: R?G?R
Matthew: RG???G
Janet: G????R
Benjamin: R????R

Pusicatto decided to paint the picture so that it had the smallest number of squares possible.

What was the order of the squares in Pusicatto’s painting?


Enigma 451: Double halved

From New Scientist #1602, 3rd March 1988 [link]

Rice Robswitt, our local darts champion, has had another mishap. He needed over one hundred to win with his three darts and he decided to go for a single, a treble and a double to win. He threw the darts and thought that he had succeeded. But the dart aimed at the single had in fact landed in an adjacent single, the dart aimed at the treble landed in an adjacent treble, and the dart aimed at the double landed in an adjacent double.

The result of all this was that Rice got exactly half the total, with the three darts that he had expected. What did he, in fact, score in total with the three darts?

(The numbers around the dartboard are ordered: 20, 1, 18, 4, 13, 6, 10, 15, 2, 17, 3, 19, 7, 16, 8, 11, 14, 9, 12, 5, 20, …)

Tantalizer 451: Death rates

From New Scientist #1002, 27th May 1976 [link]

A minor problem which has long troubled medical historians is why two seemingly identical Edwardian TB sanataria in Mercia should have strikingly different death rates. The answer turns out to be simple enough — St. Bede’s in fact had 3,185 more patients than St. Crispin’s.

How did this come to be overlooked? Well, the probable reason is that both were built on the same formula. Each had as many wings as it had wards in each wing and had as many wards in each wing as it had patients in each ward. This was so plainly the whim of some mad bureaucrat that no historian troubled to check whether the number of patients per ward was the same in each place.

So what is the figure in each case?


Enigma 1059: Century break

From New Scientist #2215, 4th December 1999

At snooker a player scores 1 point for potting one of the 15 red balls, but scores better for potting any of the 6 coloured balls: 2 points for yellow, 3 for green, 4 for brown, 5 for blue, 6 for pink and 7 for black.

Davies potted his first red ball, followed by his first coloured ball, then his second red ball, and so on until he had potted all 15 red balls, each followed by a coloured ball.

After potting 15 red balls and 15 coloured balls, Davies had scored exactly 100 points; but it was interesting because in calling his score after each pot the referee had called every perfect square between 1 and 100.

Question 1: If in achieving this Davies had potted as few different colours as possible, which of the coloured balls would he have potted?

In fact Davies had brought a greater variety to the choice of coloured balls potted: for instance the 2nd, 5th, 8th, 11th and 14th coloured balls potted were all different and if I told you what they were you could deduce with certainty which ball was potted on each of his other pots.

Question 2: What (in order) were the 2nd, 5th, 8th, 11th and 14th coloured balls potted?

(In answering both questions give the colours).


Enigma 450: A pentagonal problem

From New Scientist #1601, 25th February 1988 [link]

“I always remember my security number in the following way,” said the five-star general. “I think of the Pentagon and inscribe around its perimeter the digits from 0 to 9 using each one once and once only. Five of the digits end up on the corners and the other five equidistant between them.”

“But that can be done in too many ways to be of any use,” I protested weakly.

“Aha, and then there’s the clever bit. The sum of the three digits along any edge is the same for all five edges.”

“Isn’t that still too general, general?”

He looked crestfallen. “Well, the digits on the corners are either all odd or all even, I can never remember which.”

“That still leaves at least two possibilities,” I pointed out.

“Four actually,” he replied, “but that don’t mean a thing. Because what I do is imagine marching around the Pentagon. I pass the digits consecutively and write them down as I pass them. So I start by passing 9 and writing 9, and I stop only when I have a ten-digit number. Yeah, sure, I could walk around it clockwise or anticlockwise, and sure it makes a difference whether it’s odd numbers on the corners or even numbers, but I’m from Texas and the largest of the four possible numbers is my security number.”

What is his security number?


Puzzle 48: Verse on the island

From New Scientist #1099, 20th April 1978 [link]

We live, we three, on the Imperfect Isle,
Where all is not just what it ought to be.
One is a Wotta-Woppa and he never
Tells what is true, in fact a liar he.

And then there is another one who cannot
Make up his mind. Oh, shall I tell a lie?
He is a Shilli-Shalla, and makes statements,
One true, one false. But which? The constant cry.
The third one is a Pukka and we find
Nothing but truth comes from the third man’s mind.

Single figures all our dwellings,
And each one is different.
Three statements each, so read with care
And use your loaf to find what’s meant.


(1) First let me say no Shilli-Shalla I,
But I’m afraid I cannot tell you why!
(2) Then I point out that where numbers are concerned
The lower the truer; that’s the fact for which you yearned.
(3) Thirdly, no tricks,
My number’s less than six.


(1) and (2) A Pukka, I, and live at number one.
That’s two statements in a single line.
(3) Perfect, you might say, but not as perfect as C‘s square.


(1) A and B live on either side of me.
(2) Who is the Wotta-Woppa? Why it’s B.
(3) And now our verse
Has done its worst.
Just to finish with a wink,
To get this right you’ll have to think.
And with a nod,
A‘s number is not odd.

Where do AB and C live and what are their tribes?


Enigma 1060: In order to solve…

From New Scientist #2216, 11th December 1999

I have a row of 8 boxes labelled A, B, C, …, H. Each box contains a card with a number on it. The contents of the boxes are one of the following 17 possibilities:

13683641, (that is, 1 in A, 3 in B, 6 in C, …, 1 in H)

And here are four more facts:

P. Given the above facts, if I now tell you the number in box A then you can work out the number in box D.

Q. Given the above facts, if I now tell you the number in box B then you can work out the number in box H.

R. Given the above facts, if I now tell you the number in box F then you can work out the number in box C.

S. Given the above facts, if I now tell you the number in box G then you can work out the number in box E.

Unfortunately, I have forgotten what order the for facts P, Q, R, S should be in. I do remember that when they are in the right order you can work out the contents of the boxes. Also that there is only one order that allows you to do that.

What order should the four facts be in? And what are the contents of the boxes?


Enigma 449: He who laps last

From New Scientist #1600, 18th February 1988 [link]

“This is Hurray Talker reporting from Silverhatch on the 40-lap Petit Prix. The leaders, Hansell and Bisquet, are each going round the circuit in an incredible 59 seconds, except when they have made a pitstop. They were neck and neck for the first seven laps but then things started to go wrong. However, each pit stop has been kept down to an amazing 23 seconds. Here they come now to cross the line and complete another lap. Hansel – now. Biscuit – now. That’s just a 2-second interval. There they go off on the next lap.”

How many laps have Hansell and Bisquet completed?


Tantalizer 452: Snailspaces

From New Scientist #1003, 3rd June 1976 [link]

Four snails set off down the garden path just as dawn broke. Fe and Fi kept pace with each other, a modest but steady shuffle which had taken them a mere eight yards by the time Fo and Fum had reached the rhododendron. Fo was so puffed that he stopped for an hour’s rest and even Fum, who carried straight on, was reduced to the pace of Fe and Fi.

Fo started again just as Fe and Fi came level with him and surged away at his previous pace. Fe promptly accelerated and kept level with him but Fi continued as before. Fe was this one yard ahead of Fi at the end of the path but half an hour behind Fum.

How long is the path?


Enigma 1061: Par is never prime

From New Scientist #2217, 18th December 1999

The local golf course has 18 holes; each of them has a par of 3, 4 or 5; no two consecutive holes have the same par. If you play the holes in order from 1 to 18 and score par for each hole, the number of strokes that you have played after you have completed any hole is never a prime number.

If I told you the par for one particular hole you could deduce with certainty the par of each of the first 15 holes.

Question 1: What is the number of the hole whose par I would tell you? And what is par for that hole?

If I told you the number of the hole whose par I was going to tell you so that you could deduce with certainty the par for each of the last three holes you could in fact make that deduction even before I had told you the par for that hole.

Question 2: What is the number of the hole whose par I would be going to tell you? And what is par for that hole?


Enigma 448: Spoiling the division

From New Scientist #1599, 11th February 1988 [link]

In the following division sum, some of the digits are missing, and some are replaced by letters. The same letter stands for the same digit wherever it appears.

Find the correct sum.


Puzzle 47: Digits all wrong

From New Scientist #1098, 13th April 1978 [link]

In the following addition all the digits are wrong. But the same wrong digit stands for the same correct digit wherever it appears, and the same correct digit [is] always represented by the same wrong digit.

Find the correct addition sum.


Enigma 1062: Christmas present

From New Scientist #2218, 25th December 1999

Joseph the carpenter used to cut out rectangular blocks of wood which his young son Jesus would paint. The blocks always had whole number dimensions. They used to say a block was fair if the numerical values of its volume and its surface area were the same, for example the 4×5×20 block was fair as it had volume and surface area both equal to 400. They felt that with a fair block the both did the same amount of work.

As Jesus’s birthday was coming up, Joseph asked him to choose a number and he would try and cut a fair block with volume equal to that number. Jesus chose 2000 which so surprised Joseph that he asked Jesus if he thought people would remember him on his 2000th birthday. Jesus thought for a while then replied that it was hard to say, as it depended on so many things.

Can Joseph cut a fair block with volume 2000? If he can, give its dimensions. If he cannot, give the dimensions of the fair block with volume nearest to 2000.


Enigma 447: Secret society

From New Scientist #1598, 4th February 1988 [link]

Six boys from my class have joined together to form a secret society. The each have a different three-digit number, but each of the six numbers uses the same three digits in some different order.

The boys have noticed that, for any two of them, their numbers have a common factor larger than 1 precisely when their names have at least one letter in common. So, for example, Tom’s number and Sam’s number have a common factor larger than 1, whereas Bob’s and Tim’s numbers do not. Ken’s number is prime.

The sixth member of the society is one of Ian, Ben, Rod, Rob, Jak, Vic and Pat.

Who is the sixth member, and what is Bob’s number?


Tantalizer 453: The school play

From New Scientist #1004, 10th June 1976 [link]

No child was left out of the school play. Each was an angel, a bunny or a demon.

“Were you a bunny, dear?”, Granny asked Tom.
“No”, said Tom firmly.
“He was!”, said Dick.
“He wasn’t!”, said Harry.
“How many of you were bunnies?”, Granny asked.
“Just one”, said Harry.
“Not none”, said Dick.
“More than one”, said Tom.

Any angel had made two true statements, any bunny one and any demon none.

Who was what?


Enigma 1063: Christmas star

From New Scientist #2218, 25th December 1999

When I was at school I was given a Christmas puzzle to do. So, as far as I can remember it, I’ve reproduced it for you to try:

“Four different numbers larger than 6 have been placed in some of the circles of the Christmas star:

Put the numbers 1 to 6 in the remaining circles (one of them in each) so that the four numbers on each straight line add up to the same total.”

Now that I’ve tried this again I realise that I’ve made a mistake somewhere, because the puzzle as stated is impossible. In fact, it turns out that my only error is that one of the four numbers which I have placed on the star is incorrect.

Which one is incorrect, and what should it be?

Thanks to Hugh Casement for providing the sources for a large number of Enigma puzzles originally published between 1990 and 1999, including this one.


Enigma 446: Pocket money

From New Scientist #1597, 28th January 1988 [link]

The benefactor Lord Elpis was superstitious to a degree which surpassed mere triskaidekaphobia, shunning black cats and saluting magpies. Indeed, his superstition was more a form of sympathetic magic. He kept two watches, Tick and Tock. When Tick ran down he would wind Tock, so that Tick could rest and vice versa.

One of his many peculiarities related to money, which he only ever carried in his trouser pockets. His trousers had two pockets and two pockets only, and in these he would carry only those non-zero sums of money which could be split between the two pockets in such a way that the amount in his left pocket multiplied by the amount in his right pocket was exactly equal to the amount in the left and right pockets taken together.

Thus, for example, he could carry £6.25, as it was possible to put £5 of this in his left pocket and the remaining £1.25 in his right, since the product of these sums is equal to the sum of these sums.

Given that 100 pence equals £1 and that the penny is the smallest unit of currency:

(a) How many different sums can Lord Elpis carry?
(b) What is the most he can carry at any one time?