Enigmatic Code

Programming Enigma Puzzles

Enigma 1096: Prime break

From New Scientist #2252, 19th August 2000

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, 7 for black.

Davies potted his first red ball, followed by his first coloured ball, then his second red ball followed by his second coloured ball, and so on until he had potted all 15 red balls, each followed by a coloured ball. Since the coloured balls are at this stage always put back on the table after being potted, it is possible to pot the same coloured ball repeatedly.

Davies’ break was interesting as after he had potted each of the 15 coloured balls his cumulative score called by the referee was always a prime number.

After potting the 15 red balls and 15 coloured balls, a player’s final task is to attempt to pot (in this order) yellow, green, brown, blue, pink and black. I won’t tell you how many of those Davies managed to pot, nor could you be sure how many of them he potted even if I told you his total score for the break.

What was that total score?



Enigma 415: Buses galore

From New Scientist #1565, 18th June 1987 [link]

The Service Bus Company runs buses on the route shown by the map:

Enigma 415

Each bus starts its journey at the Terminus, T, and goes towards A. At each crossroads it goes straight across. The bus eventually enters T from B and leaves for C. It finally arrives at T from D, to complete its journey. The time to go from one crossroads to the next is three minutes and so it takes one hour to complete the journey.

Buses are timetabled to leave T on the hour and at various multiples of three minutes after the hour. When a bus completes a journey it immediately begins its next journey and so the timetable repeats each hour.

This means each bus reaches a crossroads at times 00, 03, 06, 09, …, 54, 57. The buses are timetabled so that no two buses ever reach the same crossroads at the same time. Also the buses are timetabled so that the maximum number of buses are running on the route.

How many buses are running on the route?


Puzzle 65: Division: figures all wrong

From New Scientist #1116, 17th August 1978 [link]

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

The correct division, of course, comes out exactly. All 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 1097: Chessboard triangles

From New Scientist #2253, 26th August 2000

Take a square sheet of paper of side 1 kilometre and divide it into small squares of side 1 centimetre. Colour the small squares so as to give a chessboard pattern of black and white squares.

When we refer to a triangle, we mean a triangle OAB, where O is the bottom left corner of the square of paper, A is on the bottom edge of the paper and B is on the left hand edge of the paper.

Whenever we draw a triangle then we can measure how much of its area is black and how much is white. The score of our triangle is the difference between the black and white areas, in square centimetres. For example if OA = 3 cm and OB = 2 cm then we find the score of the triangle is 1/6 cm².

Question 1. What is the score of the triangle with OA = 87,654 cm and OB = 45,678 cm?

Question 2. What is the score of the triangle with OA = 97,531 cm and OB = 13,579 cm?

Question 3. Is it possible to draw a triangle on the paper with a score greater than 16,666 cm²?


Enigma 414: Nicely bungled, Sir!

From New Scientist #1564, 11th June 1987 [link]

My Uncle, I fear, has done it again. He has been taking great interest in the activities of four local football teams — A, B, C and D — and he managed to obtain some details, not very complete ones, I am afraid, of the matches played, won, lost, drawn and so on. But no one will be surprised, perhaps not even Uncle Bungle, to hear that one of the figures given was incorrect.

The details that he had looked like this:

Enigma 414

Which figure was wrong? What was the score in the matches that had been played?


Tantalizer 473: Pigeon post

From New Scientist #1024, 28th October 1976 [link]

In the name of democracy the officers of our Pigeon Fanciers Club announce that they would not stand for re-election this year. This cheered the rest of us no end, until we found that it applied only individually. Collectively they planned to retain all five offices for the umpteenth year running.

To allay suspicions, the plot was a mite complex. There would be no direct swaps. Bumble would take the post of the man who was to become Organiser. Crumble would take the post of the man who was to become Treasurer. Dimwit would take the post of the man who would take Amble’s post. The current Vice-President would take the post vacated by the new President. Eggfrith would become Secretary, despite his wish to become the Organiser.

It all worked flawlessly, of course.

Who was and is what?


Enigma 1098: Soccer heroes

From New Scientist #2254, 2nd September 2000

There are seven teams in our local football league. Each team plays each of the others once during the season. We are approaching the end of the season and I have constructed a table of the situation so far, with the teams in alphabetical order.

Here are the first two rows of the table, but with digits consistently replaced by letters, different letters being used for different digits.

What was the score when Albion played Borough?


Enigma 413: Quargerly dues

From New Scientist #1563, 4th June 1987 [link]

A native of Kipwarm had a gold necklace consisting of links joined together to form one long unbroken loop of chain.

He has fallen on hard times and to pay his gas bill he is going to give the gas board one link of his gold necklace every day.

He has broken just a certain number of links (thus forming that number of individual links and some other variously-sized pieces of chain). By giving away and taking back certain pieces he can ensure that, at the rate of one a day, his total of links decreases and the board’s increases. Furthermore, had his necklace had one more link, it would have been necessary to break one more in order to pay the board in this way.

His necklace will last him a whole number of quargers (a Kipwarmian period of a certain number of days, less than one year). But the board has offered him an alternative way of paying. His first quarger’s gas will be free, the next will cost him one link, the next two links, the next quarger’s will cost him four links, and so on, doubling each quarger. At that rate the necklace will pay for the same number of days’ gas.

How many days are there in a Kipwarmian quarger?


Puzzle 66: Hopes and successes on the island

From New Scientist #1117, 24th August 1978 [link]

I had been away from the Island of Imperfection for some time and I was amused — and rather distressed — on a recent visit to find that there was now another tribe there.

But I had better explain. In the old carefree days, which I knew so well, there had been three tribes on the island. The Pukkas, who always told the truth, the Wotta-Woppas, who never told the truth, and the Shilla-Shallas, who made statements which were alternately true and false or false and true. I cannot pretend to know how it happened but now there is another tribe who call themselves the Jokers. I am afraid that all I can tell you about them is that in making three statements their truth-telling rules are any rules that are different from those of the other three tribes. Just to be different! That seems to be all they are interested in, and I find it hard to restrain myself from making some acid comments about the modern generation. They don’t seem to be much interested in fun or laughter but in achievement. And it is no doubt because of this that the main currency of the island is called a Success, and it made up of 100 Hopes.

Four men, ABC and D (one from each tribe), make statements as follows:

A: (1) B makes more true statements than D does.
A: (2) My income is 7 Successes and 50 Hopes per week more or less than D‘s income.
A: (3) C is a Wotta-Woppa.

B: (1) A‘s income is 2 Successes and 50 Hopes per week more or less than mine.
B: (2) D‘s second statement is true.
B: (3) C‘s income is 8 Successes and 50 Hopes per week.

C: (1) D is a Joker.
C: (2) My income is 10 Successes per week.
C: (3) B is a Pukka.

D: (1) B is a Joker.
D: (2) My income is 1 Success per week more or less than C‘s income.
D: (3) C is not a Joker.

It was rather interesting to notice that the more truthful a man the less was his income. All their incomes were a multiple of 50 Hopes.

Find the tribes to which ABC and D belong and their weekly incomes.


Enigma 1099: Unconnected cubes

From New Scientist #2255, 9th September 2000

I have constructed a cyclical chain of four-digit perfect cubes such that each cube in the chain has no digits in common with either of its neighbours in the chain. The chain consists of as many different four-digit cubes as is possible, consistent with the stipulation that no cube appears in it more than once.

If I were to tell you how many cubes lie between 1000 and 1331 either by the shorter route or by the longer route round the chain you could deduce with certainty the complete order of the cubes in the chain.

Taking the longer route round the chain from 1000 to 1331, list in order the cubes that you meet (excluding 1000 and 1331).


Enigma 412: A triangular square

From New Scientist #1562, 28th May 1987 [link]

Enigma 412

Professor Kugelbaum, deep in thought and in a distracted state, wandered onto a building site. He saw a man laying equilateral triangular slabs on a plain flat area. Turning his keen mind from the abstract to the concrete, he asked the man with a sudden inspiration, “What are you doing?”

“I’m laying a town square.”

“But the angles aren’t right.”

“Well, it’s going to be a square in the form of an enormous equilateral triangle”, was the reply.

“I don’t call nine slabs enormous.”

“Ah”, said the workman, “first, I haven’t finished yet: I’ve just started at one apex. Secondly, if you look carefully, you’ll see that there are in fact 13 different triangles to be found in the pattern I’ve already laid [see diagram]. When I’ve finished there will be 6000 times as many more triangles to be found in the completed array.”

Kugelbaum’s mind began to tick over.

How many slabs will there be in the completed array?

This puzzle brings the total number of Enigma puzzles on the site to 1,100 (and by a curious co-incidence on Monday I posted Enigma 1100 to the site). This means there are (only!) 692 Enigma puzzles remaining to post, mostly from the 1990s. There is a full archive of puzzles from the inception of Enigma in February 1979 up to May 1987 (this puzzle), and also from September 2000 up to the end of Enigma in December 2013. Happy puzzling!


Tantalizer 474: Desert crossing

From New Scientist #1025, 4th November 1976 [link]

Able, Baker and Charley all crossed the Great Lunar desert last week. They did not use the same route but each divided his journey into three stages, doing the first by camel, the second by mule and the third on foot.

Able went from P to Q, then from Q to R, then from R to S. Baker’s route was from T to Q, Q to W, W to Y. Charley chose U to Q, Q to V, V to X. All these nine stages are of different length. One man had the longest camel ride, another the longest mule ride and the third walked furthest. One had the shortest camel ride, another the shortest mule ride and the third walked least. In fact Able had the shortest camel ride or the longest mule ride or both.

It is further from P to W via Q than from U to R via Q but not so far as from T to V via Q.

Who walked furthest?


Enigma 1100: Sydney 2000

From New Scientist #2256, 16th September 2000

Whether it’s the “Sydney 2000 games in year 2000” or the “Games in year 2000 in Sydney”, either way, both are arranged in additions (I) and (II), where the only given digits appear in the number 2000 as shown and all other digits have been replaced by letters and asterisks.

In these additions, different letters stand for different digits and the same letter always stands for the same digit whenever it appears, while an asterisk can be any digit.

What is the numeric value of SYDNEY?


Enigma 411: The third woman

From New Scientist #1561, 21st May 1987 [link]

The Ruritanian Secret Service has nine women agents in Britain: Anne, Barbara, Cath, Diana, Elizabeth, Felicity, Gemma, Helen and Irene. Any two of the women may or may not be in contact with each other.

To preserve security contacts are limited by the following rule: for any two of the women there is a unique third woman who is in contact with both of the women. The British Secret Service has so far discovered following pairs of women that are in contact: Anne and Cath, Anne and Diana, Cath and Barbara, Barbara and Gemma, Elizabeth and Felicity.

Which of the women are in contact with Helen? Who is the woman in contact with both Anne and Irene?


Puzzle 67: Addition: letters for digits

From New Scientist #1118, 31st August 1978 [link]

It is, I admit, a moot point whether it is better to guess at some of Uncle Bungle’s illegible letters and to hope for the best, or just to leave them out. For some time now I have guessed, but I must admit that my guessing is not what it was, so in this sum anything that is illegible has just been left out. Letters stand for digits, and the same letter stands for the same digit whenever it appears, and different letters stand for different digits. In the final sum all the digits from 0-9 are included.

Write out the correct addition sum.


Enigma 1101: Disappearing numbers

From New Scientist #2257, 23rd September 2000

This game starts when I give a row of numbers; some numbers in italic [red] and some in bold [green]. Your task is to make a series of changes to the row, with the aim of reducing it to a single number or to nothing at all. In each change you make, you select two numbers that are adjacent in the row and are of different font [colour], that is to say one is italic [red] and the other is bold [green]. If the numbers are equal, you delete them both from the row; otherwise you replace them by their difference in the font [colour] of the larger number.

For example, suppose I gave you the row:

3, 4, 3, 2, 5, 2.

One possibility is for you to go:

[I have indicated the pair of numbers that are selected at each stage by placing them in braces, the combined value (if any) is given on the line below in square brackets].

3, 4, 3, {2, 5}, 2
3, {4, 3}, [3], 2
{3, [1]}, 3, 2
[2], {3, 2}
2, [1]

You have come to a halt and failed in your task.

On the other hand you could go:

{3, 4}, 3, 2, 5, 2
[1], {3, 2}, 5, 2
{1, [1]}, 5, 2
{5, 2}

And you have succeeded in your task.

For which of the following can you succeed in your task?

Row A: 9, 4, 1, 4, 1, 7, 1, 3, 5, 4, 2, 6, 1, 4, 8, 3, 2.

Row B: 2, 3, 5, 9, 6, 3, 1, 4, 2, 3, 1.

Row C: 1, 2, 3, 4, 5, 6, …, 997, 998, 999, 1000, 3, 5, 7, 9, 11, …, 993, 995, 997, 999.

Row D: 3, 2, 1, 4, 5, 4, 3, 2, 4, 3, 7, 4, 1, 5, 1, 4, 2, 4, 3, 1, 2, 7, 9, 3, 7, 5, 3, 8, 6, 5, 8, 4, 1, 5, 2, 3, 1, 4, 10, 6, 3, 5, 7, 4, 1, 4.

I have coloured the numbers in italics red, and those in bold green in an attempt to ensure the different styles of numbers can be differentiated.

When the problem was originally published there was a problem with the typesetting and the following correction was published with Enigma 1104:

Due to a typographical error, three of the numbers in Enigma 1101 “Disappearing Numbers” appear in the wrong font. In each case, the following should have been printed in heavy bold type:

the second number 3 in the initial example;
the first number 5 in row B;
and the first number 4 in the second line of row D.

I have made the corrections to the puzzle text above.


Enigma 410: Most right

From New Scientist #1560, 14th May 1987 [link]

The addition sums which Uncle Bungle has been making up recently, with letters substituted for digits, have been getting longer and more complicated. And no one will be surprised to hear that in the latest one everything is not as it should be. In fact one of the letters is wrong.

Here it is:

What can you say about the letter which is wrong? What should it be? Find the correct sum.


Tantalizer 475: League table

From New Scientist #1026, 11th November 1976 [link]

Here is what is left of the league table pinned in our local church door at the end of the season. It shows the number of goals scored in each match rather than the mere result. Each side played each [other side] once and there were no ties in the “points” list.

You would think that the Anvils, having scored more than half the goals scored in the entire competition, must have done pretty well. But in fact, as you see, they came bottom. The Bears beat the Eagles and drew with the Furies. At least one team drew more games than the Casuals. The Dynamos — but that’s enough information.

Can you fill in the table?


Enigma 1102: The Apathy Party

From New Scientist #2258, 30th September 2000 [link]

George called a meeting to inaugurate the National Apathy Party, open to anyone who has never voted in a General Election. He hopes to be the next Prime Minister. The turnout was phenomenal, but he managed to seat them all in Wembley Stadium (capacity 80,000). George proposed that the President and the Committee should be chosen by chance, rather than by ballot. The delegates had been allocated sequential membership numbers of arrival — George, of course, being No. 1. He proposed that one number be chosen at random by the computer — that member would be the President. All members whose numbers divide exactly into the President’s number would be on the Committee. Apathy reigned — this totally undemocratic procedure was agreed.

The computer produced an odd membership number for the President and the number of committee members, including George and the President, was an odd square greater than 10.

What was the President’s membership number?


Enigma 409: Hands and feet

From New Scientist #1559, 7th May 1987 [link]

There are six footpaths through our extensive local woods, one linking each pair of four large oaks. I decided to go on a long walk starting at one of the oaks, keeping to the footpaths, ending back where I started, covering each of the footpaths exactly twice, and never turning around part-way along a path.

Whenever I was at an oak my watch showed an exact number of minutes, and in the previous 30 seconds up to and including arriving at the oak or in the 30 seconds after leaving the oak the hour and minute hands of the watch were coincident.

I set out sometime after 6am and I was back home before midnight on the same day. I walked at a steady pace from start to finish.

What time was I at the oak at the start of my round walk, and what time did I get back there at the end of the day?