Enigmatic Code

Programming Enigma Puzzles

Tag Archives: by: Keith Austin

Enigma 517: Walk in the dark

From New Scientist #1669, 17th June 1989 [link]

Out there, somewhere in the night, is Elk Elloy, gunning for me. My only hope is to stay in the dark.

Stretching ahead of me is the Boulevard, all 3686.3 yards of it. If I can make the other end of it then I’ll be safe. But the whole length of the Boulevard is covered with neon strip lights. One hundred and ninety-three of them, each 19.1 yards long, set out end-to-end. They flash on and off steadily through the night. There go the 1st, 3rd, 5th, 7th, …, 193rd. They’re on for just an instant. Now there is a 12-second pause and then on come the 2nd, 4th, 6th, …, 192nd, for just an instant. Then another 12-second pause and we begin all over again with the odd numbered strips.

Fortunately, each strip only lights the ground directly below it, so there is a chance I can walk along the Boulevard and avoid ever being under a strip when it comes on.

There are just two catches. First, I must walk at a constant speed which is a whole number of yards per minute, otherwise I will arouse the suspicion of Patrolman Nulty who covers the Boulevard. Secondly, I cannot walk at more than 170 yards per minute.

What speed should I walk at, in yards per minute?


Enigma 993: If you lose…

From New Scientist #2148, 22nd August 1998

Each year the four football teams A, B, C and D play each other once, getting 3 points for a win and 1 for a draw. At the end of the year the teams are ordered by total points and those with equal points by goal difference. Any still not ordered are then ordered by goals scored and then, if necessary, by the result of the match between the two to be ordered. Any still not ordered draw lots. The top two teams with a prize.

The order the games are played in can vary, except that A always plays its opponents in the order B, C, D, and A vs B is always the very first match of the year.

By an amazing coincidence the following has happened in 1996, 1997 and 1998. One hour before A v C kicks off, team A’s manager/mathematician announces to the team that if they lose to C then they cannot possibly get a prize. Team A has gone on to win a prize in spite of losing to D.

1. Is it possible in 1996 A vs C was the 3rd game of the tournament?

2. In 1997, A vs C was the 4th games of the tournament. Name the two teams that you can say for certain met in the 2nd or 3rd game of the tournament.

3. In 1998, a total of 4 goals was scored in the tournament. What was the score in B vs C?


Enigma 513: Less than a bargain

From New Scientist #1665, 20th May 1989 [link]

The fruit stall proclaimed, “Our fruit is so cheap it is even less than a bargain”, and so it had a good number of customers.

Hannah bought an apple and two bananas and yet spent less than Sarah who bought an orange and a 10-pence lemon. Joan bought 10 apples, 11 bananas and two oranges and yet did not spend all the 107 pence in her purse. Alan bought three apples, two bananas and an orange and his bill was less than 30 pence. Only Mot was unlucky: he tried to buy eight apples, seven bananas and two oranges, but they came to more than the 79 pence in his pocket.

Each piece of fruit cost a whole number of pence.

What was the cost of each apple, banana and orange?


Enigma 999: Combined celebrations

From New Scientist #2154, 3rd October 1998 [link]

To celebrate next week’s 1000th edition of Enigma, we each made up an Enigma. Each one consisted of four clues leading to its own unique positive whole number answer. In each case none of the four clues was redundant. To avoid duplication, Keith made up his Enigma first and showed it to Susan before she made up hers.

The two Enigmas were meant to be printed side-by-side but the publishers have made a (rare) error and printed the clues in a string:

(A) It is a three-figure number;
(B) It is less than a thousand;
(C) It is a perfect square;
(D) It is a perfect cube;
(E) It has no repeated digits;
(F) The sum of its digits is a perfect square;
(G) The sum of its digits is a perfect cube;
(H) The sum of all the digits which are odd in Keith’s answer is the same as the sum of all the digits which are odd in Susan’s.

Which four clues should have formed Keith’s Enigma, and what was the answer to Susan’s?

There are now 1300 Enigma puzzles available on the site (or at least 1300 posts in the enigma category). There are 492 Enigma puzzles remaining to post.

There are currently also 76 puzzles from the Tantalizer series, 75 from the Puzzle series and 13 from the new Puzzle # series of puzzles that have been published in New Scientist which together cover puzzles from 1975 to 2019 (albeit with some gaps).

I also notice that the enigma.py library is now 10 years old (according to the header in the file – the creation date given coincides with me buying a book on Python). In those 10 years it has grown considerably, in both functionality and size. I’m considering doing a few articles focussed on specific functionality that is available in the library.


Enigma 508: A colourful deception

From New Scientist #1660, 15th April 1989 [link]

Tour the Tulip Fields of Bulbania

Enigma 508

Towns: Aldingsp, Beachhol, Chholbea, Dingspal, Eachholb, Fresh, Gspaldin.

The colours are those of the tulips in that area.

You will fly to Eachholb and then drive by coach, visiting each town exactly once.

“Miss Wheel, I understand you will be driving the coach for the tour. I am afraid we have a problem. The flight is being diverted to Chholbea, so you will collect your passengers there.”

“We do not want the tourists to realise there has been a change to the tour as advertised on the above leaflet, as they might ask for their money back. Now, they will not be able to read the names of the towns as they are in Bulbanian, but they can tell the colours of the tulips and they have the map. I want you to start at Chholbea and drive round visiting each town exactly once, but so that as the tourists notice the colours on each side of the road, they will believe from their map that they are following a route as described on the leaflet, beginning at Eachholb.”

What route did Miss Wheel take and what route did the tourists think they were taking?

Some of the Bulbanian towns are anagrams of the Lincolnshire town of Spalding, and others are anagrams of town of Holbeach, also in Lincolnshire.


Enigma 1004: The art of cubes

From New Scientist #2159, 7th November 1998 [link]

The great artist Pussicato started his latest work by selecting the number 28 as his starter. He wrote down the divisors of 28, namely, 1, 2, 4, 7, 14, and 28. He then wrote down how many divisors each of these numbers has: 1 has 1, 2 has 2, 4 has 3, 7 has 2, 14 has 4, and 28 has 6. He took these numbers of divisors. 1, 2, 3, 2, 4 and 6, to his studio and carved out 6 cubes with dimensions: 1 × 1 × 1, 2 × 2 × 2, 3 × 3 × 3, 2 × 2 × 2, 4 × 4 × 4 and 6 × 6 × 6.

Pussicato arranged the cubes tastefully and called the work “28”. He also noticed the total volume of the work was 324.

Question 1: Is it possible for Pussicato to choose a starter so that the resulting collection of cubes has a total volume of 729? If it is, what is the smallest starter he can use?

Question 2: Is is possible for Pussicato to choose a starter so that the resulting collection of cubes has a total volume of 47,382. If it is, what is the smallest starter he can use?

Question 3: Pussicato chose a starter and produced a collection of cubes with a total volume of 571,536. He then piled the cubes, one on top of the other, to form a high tower. How high was the tower?


Enigma 504: Hooray for Hollywood

From New Scientist #1656, 18th March 1989 [link]

Twentieth Century Lion Studios has just held a week-long film festival celebrating 60 years of talking pictures. It first selected seven of the studio’s legendary stars. It then chose seven of the studio’s classic films so that each of the 21 possible pairs of stars appeared together in one of the films.

The stars were selected from Fred Astride, Humphrey Bigheart, Joan Crowbar, Bette Daybreak, Judy Garage, Clark Gatepost, Katherine Hipbone, Barbara Standup, James Student, Spencer Treacle, John Weighing. The films were chosen from the following list in which each film is given with its stars:

Cosiblanket, JC, JG, BS
Top Hit, BD, JG, KH
Stagecrouch, HB, CG, KH
A Star is Bone, HB, JC, JS
Mildred Purse, CG, ST, JW
High None, HB, JG, ST
King Koala, FA, JG, CG
Random Harpist, BD, KH, JS
Now Forager, JC, BD, CG
Mrs Minimum, CG, JS, JW
The Adventures of Robin Hoop, KH, BS, JW
The Maltese Foghorn, FA, JC, ST
Mr Deeds goes to Tune, BS, JS, ST
Meet me in St Lucy, BD, CG, BS
Gone with the Wine, FA, HB, BD
Singing in the Rind, FA, JC, KH
Mutiny on the Bunting, BD, ST, JW
The Best Years of our Lifts, FA, HB, BS
Double Identity, FA, JG, JS

Which seven films were selected?


Enigma 500: Child’s play

From New Scientist #1652, 18th February 1989 [link]

The children at the village school have a number game they play. A child begins by writing a list of numbers across the page, with just one condition, that no number in the list may be bigger than the number of numbers in the list. The rest of the game involves writing a second list of numbers underneath the first; this is done in the following way. Look at the first number — that is, the left-hand one, as we always count from the left. Say it is 6, then find the sixth number in the list — counting from the left — and write that number in the first place in the second row — so it will go below the 6. Repeat for the second number in the list, and so on. In the following example, the top row was written down, and then playing the game gave the bottom row:

6,  2,  2,  7,  1,  4, 10,  8,  4,  2,  1
4,  2,  2, 10,  6,  7,  2,  8,  7,  2,  6

The girls in the school use the game to decide which boys are their sweethearts. For example, Ann chose the list of numbers:

2,  3,  1,  5,  6,  4

For a boy to become Ann’s sweetheart he has to write down a list of numbers, play the game, and end with Ann’s list on the bottom row.

Bea chose the list:

2,  3,  2,  1,  2

and Cath the list:

3,  4,  5,  6,  7,  1,  2,  5,  7,  3,  6,  9

Find all the lists, if any, which enable a boy to become the sweetheart of Ann, of Bea, and of Cath.

Enigma 1736 is also called “Child’s play”.


Enigma 1011: The ribbon’s reach

From New Scientist #2165, 19th December 1998 [link]

Mary is wrapping her last Christmas present, which is a rectangular box which measures 1 metre by 1 metre by 2 metres. She has attached one end of a piece of ribbon to a corner of the box. Amazingly, she finds that the ribbon is just long enough to reach any point on the surface of the box; however if it were any shorter it would not be able to do that.

How long, to the nearest millimetre, is the ribbon?


Enigma 497: The longest puzzle in the world?

From New Scientist #1649, 28th January 1989 [link]

Hannah, Joan and Sarah each live at a different one of the three houses numbered 1, 2, 3. Alan, Michael and Peter each painted a different one of those three houses. Each of the three women met a different one of the three men at the shops.

There are four clues as to who lives where, and so on. However, as the clues are very long they are given here only in a condensed form, and so you may wish first to write them out in full, as indicated.

(1) Write out “the man who painted the house of the woman who met, at the shops,” (1988 + the number of the house of the woman met by Peter) times. Write the copies of the repeated phrase one after the other, and then, in front of the first copy write “Alan is” and, after the last copy, write “Alan.” to make one very long sentence which is the first clue.

(2) This is similar to clue (1), but has “Michael is” at the start and “Peter.” at the end.

(3) Write out “the woman who met, at the shops, the man who painted the house of” (1066 + the number of the house painted by the man who met Hannah) times. Add “Hannah is” at the start and “Joan.” at the end.

(4) This is similar to clue (3), but the repeated phrase is “the house that was painted by the man who met, at the shops, the woman who lives at”, the clue starts with “Number 1 is” and end with “Number 2.”

What are the facts, that is, who lives where, who painted which house, who met who?


Enigma 1017: Paint the line

From New Scientist #2173, 13th February 1999 [link]

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?


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 489: Habitadd

From New Scientist #1640, 26th November 1988 [link]

My word processor has developed a curious habit. As I type out a puzzle from my manuscript, it increases all the numbers I have written, as follows.

It adds 2 to the 3rd number in the puzzle, then it adds 5 to the 6th number in the puzzle, then it adds 8 to the 9th number in the puzzle, and so on.

Recently, I bought 8 apples, 9 oranges and 10 pears and paid 38 pence, whereas my wife bought 13 apples, 13 oranges and 14 pears and paid 51 pence and my daughter bought 16 apples, 18 oranges and 18 pears and paid 54 pence.

The word processor also makes any other necessary changes to the wording so that the puzzle is grammatically correct.

What was the cost of each apple, each orange and each pear?


Enigma 1022: Only

From New Scientist #2178, 20th March 1999 [link]

The six islands of A, B, C, D, E and F are linked by planes of Red Airline and Green Airline. For any pair of islands there are four possibilities for the route between them:

(1) no planes fly on the route;
(2) only red planes fly to and fro on the route;
(3) only green planes fly to and fro on the route; or
(4) both airlines fly their planes to and fro on the route.

We say Island X is linked by Red to Island Y if we can fly from X to Y using only Red planes; similarly for Green. We say X is directly linked by Red to Y if Red planes fly on the route between X and Y; similarly for Green. We say X is indirectly linked by Red to Y if they are linked by Red but not directly linked by Red; similarly for Green.

We have the following information (I):

I1: Island A is linked by Green to only D and E.
I2: Only B and C are linked by Red to D.
I3: Island B is linked only by Red to C.
I4: Island A only links indirectly by Green to D.
I5: Island F is directly linked by Red to only one of the islands.

Question 1: For each of the following four statements, say whether it is true, false or we cannot say whether it is true or false:

(a) Island B is only indirectly linked by Red to D.
(b) Island A is only indirectly linked by Red to E.
(c) There are only two islands that F is not linked to.
(d) If E is linked to F by Red or Green, and it is possible to fly from A to B with only one intermediate stop, then E is only indirectly linked by Red to F.

For the past number of years the airlines have ensured that the pattern of Red and Green flights is never the same in any two years. However, they have allowed only patterns that ensure the statements (I) are true. They now find this is the last year they will be able to carry on this practice.

Question 2: For how many years have the airlines been following this practice?


Enigma 484: Who knows?

From New Scientist #1635, 22nd October 1988 [link]

There were 10 candidates A, B, C, …, J for an examination consisting of six multiple-choice questions P, Q, …, U. For each question there were five choices numbered 1 to 5 and just one choice was correct. The candidates’ answers are given in the following table:

Enigma 484

Three logicians, X, Y, Z, were shown the table and told that one candidate had got all six questions correct.

X was told the answer to P and asked if she knew the answer to Q. Y was told X’s answer and also the answer to R, and asked if she knew the answer to S. Z was told Y’s answer and also the answer to T, and asked if she knew the answer to U.

If I told you Z’s answer then you could choose one of the six questions so that, if I told you its answer, then you could tell me which candidate got all six questions correct.

What was Z’s answer?

Which question would you want to know the answer to?

If I told you the answer to your chosen question was 1, which candidate would you tell me got all six questions correct?


Enigma 1028: A perfect pass

From New Scientist #2184, 1st May 1999 [link]

This is part of a football pitch; C is a corner, CE is a goal-line, CD is a side-line and AB is a side of the penalty area. Rovers have been awarded an indirect free-kick at the point F on AB and the ball is placed at F. Two players, Fay and Patricia, got to G on CD to discuss their plan. Then together they set off running, Fay towards F and Patricia towards P, each at a steady speed. After 10 seconds Fay reaches F and Patricia reaches P. Fay immediately takes the free-kick and kicks the ball along FA, so that it travels at a steady speed. Patricia carries on running at the same speed and in the same straight line. At the moment Patricia reaches AF, the ball reaches Patricia. Our problem is to find the speed of the ball, as follows:

Draw a line which passes through two of the labelled points, A, B, C, … Select a point where your line crosses an existing line and mark it X. Select a labelled point and mark it Y. You are to do this so that the distance between X and Y is the distance the ball travels in 10 seconds.

Which to labelled points should you choose to draw the line through? Which point is Y?




Enigma 479: Road island

From New Scientist #1630, 15th September 1988 [link]

On the faraway island of Roadio, the quaint villages with the curious one letter names A, B, C, …, S are joined by a network of roads as shown:

Enigma 479

The numbers indicate distances between villages in miles. I have written on all the distances I remember, however I also recall that, by road, no village is more than 20 miles from D and no village is more than 29 miles from P. What is the maximum distance between any two villages on the island?


Enigma 1033: Squirrels up and down

From New Scientist #2189, 5th June 1999 [link]

Samantha and Douglas are counting the squirrels visiting their garden. They record the monthly total for each of the 15 months January 1998 to March 1999. Samantha calculates that the number of squirrels is increasing, for she divides the 15 months into three five-month periods and finds the five-month totals are increasing with time. For example, there were more squirrels June to October 1998 than January to May 1998. But Douglas says the number of squirrels is decreasing, for he divides the 15 months into five three-month periods and finds the three-month totals decreasing with time, for example there were fewer squirrels April to June 1998 than January to March 1998.

1. Could there have been a total of 4 squirrels for the two months April and May 1998 and fewer than 75 squirrels for the whole of the 15 months? If so, how many squirrels were there for the 15 months?

2. Could there have been a total of 5 squirrels for the two months April and May 1998 and a total of fewer than 65 squirrels for the 15 months?

3. Could there have been 107 squirrels in June 1998 and 100 squirrels in October 1998? If so, how many squirrels were there in the 15 months?

4. Could there have been 108 squirrels in June 1998 and 100 squirrels in October 1998? If so, how many squirrels were there in the 15 months?


Enigma 1035: Connected numbers

From New Scientist #2191, 19th June 1999 [link]

Take a large sheet of paper and write on it the numbers, 5, 6, 7, …, 999998, 999999, 1000000. You are now going to draw lines that connect pairs of the numbers as follows. Start with 5. Split 5 into two numbers, both larger than 1, in as many ways as you can. So 5 = 2 + 3. Multiply the two numbers together. Now 2 × 3 = 6, so draw a line connecting 5 and 6. The next number is 6. Now 6 = 2 + 4 = 3 + 3 and 2 × 4 = 8 and 3 × 3 = 9, so draw a line connecting 6 and 8 and another connecting 6 and 9. The next number is 7 = 2 + 5 = 3 + 4, and so we draw a line that connects 7 and 10 and another connecting 7 and 12.

Repeat the procedure for 8, 9, 10, …, in turn. Note that when a product is larger than 1000000 then no line is drawn, for example: 500002 = 2 + 500000 = 3 + 499999 = …, so a line is drawn connecting 500002 and 1000000 but no line is drawn for 3 × 499999 = 1499997.

1) When your diagram is complete, are there two numbers, both less than 250000, such that there is no path along the lines connecting one to the other?

Now for your second task, take another piece of paper. You want to write the numbers 5, 6, 7, …, 98, 99, 100 on it, and then copy onto it, from your first piece of paper, all the lines connecting numbers which are both less than or equal to 100.

2) Can you complete your second task in such a way that no two of the lines in fact cross?


Enigma 475: Dance hall

From New Scientist #1626, 18th August 1988 [link]

At the dance there are 10 girls, Ann, Babs, Cath, Dot, Emma, Fay, Gwen, Hazel, Irene and Jane, and 10 boys. Jane knows one boy and Tom knows one girl, but I cannot tell you who they know. However, I can tell you all the other acquaintances:

Ken knows D, F;
Len knows E, H, I;
Mac knows B, F, G, I;
Ned knows A, B, H;
Owen knows E, G, I;
Pat knows A, B, C, D;
Quentin knows E, G;
Ray knows A, C;
Sam knows C, E.

The first dance pairs them off as follows:

Ann takes the hand of the first boy she knows, Ned (first always means first in alphabetical order), Babs does the same to Mac, then Cath, to Pat, then Dot, to Ken, then Emma, to Len. When Fay approaches Ken she finds he is holding Dot’s hand and the procedure becomes more complicated.

They form a line of the dance floor, F, K-D and ask the first boy who knows any girl on the floor to come out, bringing any girl that is holding his hand. The line becomes F, K-D, M-B. The procedure is repeated to give F, K-D, M-B, N-A. Repeating adds P-C to the line. Repeating again adds Ray to the line and the procedure stops as he has his hands free. The we have the line F, K-D, M-B, N-A, P-C, R.

Now Ray takes the hand of the girl he knows who is nearest to Fay in the line, Ann, and she releases Ned’s hand. Ned repeats the procedure Ray used and takes the hand of Babs who releases Mac. Mac repeated the procedure and takes the hand of Fay. That completes the pairing for Fay’s round.

The procedure is repeated for Gwen, Hazel, Irene, and Jane in turn. The pairing obtained after Jane’s round includes C-S, D-K, F-M, H-N and I-L.

Who do Jane and Tom know?

Note: I corrected a typo in the original puzzle while transcribing this (and I hope I didn’t introduce any more myself).


%d bloggers like this: