Enigmatic Code

Programming Enigma Puzzles

Enigma 1014: Mirror image

From New Scientist #2170, 23rd January 1999

Harry was playing about with his calculator and keyed in a 4-digit number. He placed a mirror behind and parallel to the display, and added the reflected number, which was smaller, to the number on the display. This gave him a 5-digit sum.

He then again keyed in the original number, and this time subtracted the reflection from it.

He divided the sum by the difference and found that the quotient was a 4-digit prime.

What was his original number?


Tantalizer 431: Hand signals

From New Scientist #982, 8th January 1976 [link]

Here is a strange fact about the parish council at Loose Chippings. The left-handed members always tell the truth but the right-handed members never do. Or perhaps it is the other way round. At any rate ambidextrous members certainly make just one true statement in every two.

And here is what five members have to say about each other:

Alfred: “Bernie is left-handed. Edward is left-handed.”
Bernie: “Alfred is right-handed. David is right-handed.”
Charles: “Alfred is ambidextrous. I am ambidextrous.”
David: “Charles is left-handed. I am right-handed.”
Edward: “Alfred is left-handed. Bernie is ambidextrous.”

Who is what?


Enigma 495: Lack of details

From New Scientist #1647, 14th January 1989 [link]

Four football teams are to play each other once. After some of the matches had been played a document giving a few details of the matches played, won, lost and so on was found. This time I am glad to say that, although it was rather a mess, all the figures given were correct. Here it is:

Enigma 495

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

Find the score in each match.


Enigma 1015: Money-spinner

From New Scientist #2171, 30th January 1999

In my local pub there is an electronic “slot machine” which offers a choice of various games. In one of them, called Primetime, after inserting your pound coin the 9 digits 1-9 appear in random order around a circle. Then an arrow spins and stops between two of the digits. You win the jackpot if the two-digit number formed clockwise by the two digits on either side of the arrow has a two-figure prime factor. So, if the digits and arrow ended up as above, you would win the jackpot because 23 is a factor of 92.

However, with the digits in the same position but with the arrow between 8 and 1 you wound not win.

I recently played the game. The digits appeared and the arrow started to spin. But I realised to my annoyance that, no matter where the arrow stopped, I could not with the jackpot.

Starting with 1, what is the clockwise order of the digits?


Puzzle 25: Body and soul

From New Scientist #1076, 3rd November 1977 [link]

I have been trying to persuade my employees at Our Factory of the merits, whatever Shakespeare’s Julius Ceasar may have said, of an honest soul in a slim body; and the connection between weight and truth. Alf, Bert, Charlie and Duggie have become particularly weight conscious and they were making some remarks one day about the latest news the scales had given them.

They spoke as follows:

Alf: Bert is lighter than Duggie.
Bert: Alf is heavier than Charlie.
Charlie: I am heavier than Duggie.
Duggie: Charlie is heavier than Bert.

I found it interesting to note that my theory was supported. In fact the only one of these remarks to be true was that made by the lightest of the four men (their weights were all different).

Arrange Alf, Bert, Charlie and Duggie in order of weight.


Enigma 494: Look blank

From New Scientist #1646, 7th January 1989 [link]

In the following long division sum I’ve marked the position of each digit. I can tell you that there were no 1s and no 0s but that all other digits occurred at least twice. Also (although you don’t actually need this information) all four digits of the answer were different.

Enigma 494

What is the six-figure dividend?


Enigma 1016: Semi(pr)imes

From New Scientist #2172, 6th February 1999

A semi-prime is the product of two prime numbers. Sometimes when the digits of a semi-prime are reversed, the resulting number is also a semi-prime: 326 and 623 (2 × 163 and 7 × 89 respectively) are both semi-primes. More rarely the sum of these two semi-primes is itself a semi-prime, as with 326 + 623 = 949 = 13 × 73.

In fact, 949 is the largest of very few three-digit semi-primes that have these characteristics; but two of the three-digit semi-primes that can be the sum of two semi-primes, of which one is the reverse of the other, are consecutive numbers.

Identify these two consecutive three-digit numbers and the sums that lead to them. (Give your answer in the form a = b + c and d = e + f, where d = a + 1).


Tantalizer 432: A way with the ladies

From New Scientist #983, 15th January 1976 [link]

The Rätselgarten in Vienna is famous for its twenty goddesses, whos statues stand at the junctions of its paths. The task of keeping them spick and span belongs to Stephan Schnitzel. Once a month he dusts and polishes them, following a route of his own design which, without leaving the paths show, takes him to each goddess exactly twice.

Each goddess has a different letters on the plan in his office and his order of visiting is, he tells me:

P A D M O I C T F K G B J R H N L Q E S P A L Q J R H N D M O I C T S F E K G B.

But, as you will no doubt spot without even being told which letter to put at which junction, he has made a small error in the telling. He has inadvertently put two consecutive letters in the wrong order somewhere.

Can you work out which they are?


Enigma 493b: Christmas cards

From New Scientist #1644, 24th December 1988 [link]

The five couples in Yuletide Close send cards to some of their neighbours. Some of them told me who (apart from themselves) send cards.

Alan: “The cards not involving us are the ones exchanged between Brian’s and Charles’s houses, the ones exchanged between Brian’s and Derek’s, the card from Charles to Derek (or the other way round, I’m not sure which) and the card from Brian to Eric (or the other way round).”

Brenda: “Apart from our cards, Alice and Emma exchange cards, as do Dawn and Christine, and Dawn sends Emma one.”

The Smiths: “The cards not involving us are the ones exchanged by the Thomases and the Unwins, those exchanged by the Williamses and the Vincents, the one from the Thomases to the Williamses and one between the Unwins and the Vincents (but I forget which way).”

No 3: “Nos 1 and 5 exchange cards, one card passes between Nos 2 and 4 (I don’t know which way) and No 2 sends one to No 1.”

Charles Thomas receives the same number of cards as he sends. On Christmas Eve, he goes on a round tour for drinks. He delivers one of his cards, has a drink there, takes one of their cards and delivers it, has a drink there, takes one of their cards and delivers it, has a drink there, takes one of their cards and delivers it, has a drink there, collects the card from them to him and returns home, having visited every house in the close.

Name the couples at 1-5 (for example: 1, Alan and Brenda Smith; 2, …).

Enigma 1321 is also called “Christmas cards”.

This completes the archive of Enigma puzzles from 1988. There is now a complete archive from the start of Enigma in 1979 to the end of 1988, and also from February 1999 to the final Enigma puzzle at the end of 2013. There are 1265 Enigma puzzles posted to the site, which is around 70.8% of all Enigma puzzles published.

[enigma493b] [enigma493]

Enigma 1017: Paint the line

From New Scientist #2173, 13th February 1999

Pussicato, the great artist, is starting his new commission. The canvas is a horizontal line, 6 metres long, and he has to paint parts of it red according to a rule he has been given. He selects a point P on the line and measures its distance, x metres from the left hand end.

He then works out the number:

1/(x – 1) + 2/(x – 2) + 3/(x – 3) + 4/(x – 4)

If the number is 5 or more then he paints the point P red, otherwise he leaves it unpainted.

For example when x = 2.1 he gets the number 15.47… , which is more than 5, and so he paints P red. And when x = 1.7 he gets –9.28…, which is less than 5, and so he leaves P unpainted.

Pussicato repeats this for every point of the line, except those with x = 1, 2, 3 or 4, which he has been told to leave unpainted.

When he has finished he finds that four parts of the line are painted red and their total length is a while number of metres. (Pussicato could have worked all that out without doing the painting).

What is the total length of the red parts?


Puzzle 26: Some old men on The Island of Imperfection

From New Scientist #1077, 10th November 1977 [link]

There are three tribes on The Island of Imperfection, the Pukkas who always tell the trith, the Wotta-Woppas who never tell the truth, and the Shilli-Shallas who make statements which are alternately true and false or false and true.

This story deals with four men whom we shall call ABC, and D and there is at least one representative of each tribe among them.

They make statements in accordance with their tribal characteristics as follows:

(1) My age is a multiple of six;
(2) My age is not the same as B‘s age;
(3) D belongs to a more truthful tribe than I do.

(1) I am older than A;
(2) The ages of A and C are the same;
(3) D‘s age is a multiple of twelve.

(1) I am older than A;
(2) D‘s age is even;
(3) B‘s second remark is true.

(1) B is three times as old as C;
(2) My age is twelve more than A‘s age;
(3) C‘s age is a multiple of thirteen.

People tend to live for a long time on this wonderful island, but none of the four with whom this story deals is older than 105.

Find the tribes to which each man belongs, and their ages.


Enigma 493a: Little donkey

From New Scientist #1644, 24th December 1988 [link]

On the faraway Pacific island of Boxingday (not far from Christmas Island), the one letter words A, B, C, …, R, S, T are names of animals. However, an animal can have more than one name, for example, the letters A, B, C, D, E, F, G, H, I, J, K, L, M actually name only 7 different animals. The animal with the most different names is the donkey.

Just before Christmas, Miss Swayingpalms asked each child in her class to write down which animals they wanted to be in their nativity play. In their excitement the children sometimes wrote down the same animal more than once, but using different names. Thus:

Joseph write down A, B, C, D, E which name only 4 animals
Mary wrote down A, G, E, S which name 3 animals
Elizabeth B, E, A, R; 4 animals
John B, I, G; 2 animals
Anna B, I, N; 2 animals
David C, A, T, S; 2 animals

and so on:

D, O, G; 2
D, R, A, G; 2
F, I, B; 2
F, I, T; 2
G, O, A, T; 2
H, A, T; 2
M, I, C, E; 4
N, I, L; 2
N, O, P, Q; 2
Q, R, S, T; 4
R, A, C, E; 3
R, A, T, S; 3
R, I, P, E; 4
R, O, B, E; 4
S, H, A, C, K; 2
S, P, A, R, E; 3
T, A, C, K; 2
T, R, A, I, L, S; 5

Eventually the nativity play was ready. As Miss Swayingpalms brought in the baby Jesus in his manger, she explained to the children that it did not matter about the repeated names, “It’s not what you are called that matters, but what you are!”

How many children did not want a donkey in the Nativity play?

[enigma493a] [enigma493]

Enigma 1018: Half-time

From New Scientist #2174, 20th February 1999

Professor Dolittle shades in those squares corresponding to one of his lectures. He has at least one lecture a day (and on some days he actually has more than one) and no two consecutive days have exactly the same lecture times. On just one day he has no afternoon lectures. Dolittle only seems to work half the week: it is possible to cut the timetable into two pieces of equal area, with one straight cut, so that one half is completely free of shading.

Someone was needed to give an extra lecture at one of two times next week: the one later in the week was also at a later time of day. I asked the professor if he was lecturing at those times. I knew that his answer together with all the above information, would enable me to work out his complete timetable.

In fact, he was free for just the first of those two times and he agreed to take an extra lecture at that time. If I told you the day of that extra lecture you would be able to work out his complete timetable.

Please send in a copy of the professor’s timetable (without the extra lecture added).

In the magazine this puzzle seems to have been labelled: “Enigma 1081“.


Tantalizer 433: Service break

From New Scientist #984, 22nd January 1976 [link]

Once a year, when the sand is right for sand castles, the trout are rising nicely in the streams and the hart is doing its proverbial panting, the New Scientist decides to remove the grime from its typewriters and moth from its editors. The latter then take off for the hills, having summoned the old team of Amble, Bumble, Crumble and Dimwit to attend the former.

The task always takes longer than it should because the four worthies are not all available. Three years ago Amble, Bumble and Crumble did it in 12 days. Two years ago Bumble, Crumble and Dimwit managed it in 15 days. Last year Amble, Crumble and Dimwit knocked it off in 18 days. And this year Amble, Bumble and Dimwit were expecting to romp through it in 20 days, until Amble and Bumble fell under a bus.

If the whole job falls on Dimwit, how many days will it take?


Enigma 492: Unlucky 13

From New Scientist #1643, 17th December 1988 [link]

The table below gives some information about the matches played, won, lost, drawn, goals for and goals against by four teams who are eventually going to play each other once. But the table is not complete. If it were, 24 figures would be given, but only 13 have been remembered. I might have known that there would be something unlucky about this and I would have been right, for one of these figures is incorrect. The table looked like this:

Enigma 492

Which figure was wrong? What should it be? Find the correct score in each match.


Enigma 1019: Conversion rates

From New Scientist #2175, 27th February 1999

If Britain doesn’t join the common European currency, the British will have to get used to converting pounds into euros or vice versa.

Maybe pounds will be double the value of euros, maybe even four times the value:

(a) EUROS × 2 = POUNDS
(b) EUROS × 4 = POUNDS

These two multiplications are entirely distinct — any letter may or may not have the same value in one sum as the other. But within each sum each letter represents a different digit, the same letter represents the same digit wherever in the sum it appears, and no number starts with a zero.

Just as the multiplier in (b) is double that in (a), so is the number of solutions — there is just one solution to (a) but there are two to (b).

Please find the six-digit numbers represented by POUNDS in the solution to (a) and in each of the solutions to (b).

A correction was published with Enigma 1023, that: the phrase “any letter may not have the same value” should have read “any letter may or may not have the same value”. I have made the correction in the text above. It think all it’s trying to say is that the two alphametic sums should be treated separately, and don’t necessarily use the same mapping of letters to digits.


Puzzle 27: Addition (letters for digits – 2 numbers)

From New Scientist #1078, 17th November 1977 [link]

In the addition sum below, letters have been substituted for digits. The same letter stands for the same digit wherever it appears and different letters stand for different digits.

Write the sum out with numbers substituted for letters.


Enigma 491: Times check

From New Scientist #1642, 10th December 1988 [link]

Enigma 491

These are, in fact, the same product done by long multiplication in two different ways, with the two multiplicands simply reversed in order. Between them, those two three-figure numbers use six different non-zero digits. And the final answer, which is of course the same for both, has all the digits different and non-zero.

What is the final answer?


Enigma 1020: Slow progress

From New Scientist #2176, 6th March 1999

I have a novelty clock which shows the time digitally from 1:00 to 12:59. The display is green at those times when the individual digits displayed form, in the order shown, an arithmetic progression. The display is red at all other times. So, for example, the display is green at 1:35, 2:10, 3:33 and 12:34.

My nephew has an identical clock, but whereas mine shows the correct time, his is a whole number of minutes (less than an hour) slow.

The display on the two clocks are continuously the same colour as each other for over two hours.

How many minutes slow is my nephew’s clock?


Tantalizer 434: Limited editions

From New Scientist #985, 29th January 1976 [link]

Boremaster’s commentary on Hegel being a basic book, our library has several copies. It is not exactly a jolly read, as you will know if you have ever waded through its 36 chapters, but is much in demand on the ground that it is less painful than Hegel himself. Even so I was surprised to meet my friend Jones leaving the library with three copies under his arm.

“Steady on, old bean!” I exclaimed, “there are other readers to think of.”

“The other copies are all on the shelf”, he replied airily, “but I had to take three to get a complete text. Some rotter has snipped whole chapters out of every copy.”

“Well, surely two copies would have done?”

“No. No two copies would yield a full text.”

“Do you mean that I shall have to check every copy, if I want to be sure of a full text?”

“Oh no. Just take any three at random, as I did. You are bound to get a full text, even through no chapter is present in all copies. For each pair of chapters there is at least one copy with only one of them.”

For this to be true, how few copies need the library have in total?


%d bloggers like this: