Enigmatic Code

Programming Enigma Puzzles

Tag Archives: by: Keith Austin

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).


Enigma 471: What you do is what you get

From New Scientist #1622, 21st July 1988 [link]

You are given the following four instructions:

A. Put the card in box 1 into box 2, put the card that was in box 2 into box 3, put the card that was in box 3 into box 4, and put the card that was in box 4 into box 1.
B. Exchange the cards in boxes 1 and 4, and exchange the cards in boxes 2 and 3.
C. Exchange the cards in boxes 1 and 2, and exchange the cards in boxes 3 and 4.
D. Exchange the cards in boxes 1 and 3, and exchange the cards in boxes 2 and 4.

If you wrote the four instructions in any order then you get a procedure, e.g. B, C, A, D. The procedure is applied to four boxes numbered 1, 2, 3, 4, which initially contain cards labelled A, B, C, D, respectively.

To apply the procedure, simply obey the instructions in the selected order, e.g. for order B, C, A, D, we obey B to get D in 1, C in 2, B in 3, A in 4, then obey C to get C in 1, D in 2, A in 3, B in 4, then obey A to get B in 1, C in 2, D in 3, A in 4, and finally obey D to get D in 1, A in 2, B in 3, C in 4. This instruction order B, C, A, D produces final card order D, A, B, C.

Which instruction order produces a final card order which is the same as that instruction order?


Enigma 1042: Days of the year

From New Scientist #2198, 7th August 1999 [link]

Long ago, a village used a calendar similar to ours, except that February had 30 days. The villagers kept track of what day of the year it was, from Day 1, 1 January, to Day 367, 31 December.

If villagers wanted to know in which month Day D was, where D was a particular number, then they would go to the village green, where there were three piles of stones, one red, one yellow and one blue, containing RY and B stones respectively. The villager would calculate:

((D × R) + Y) ÷ B

and discard any figures to the right of the decimal point in the result of the calculation. The final answer would give the month, where 1 = January, …, 12 = December. This if R = 12, Y = 373, B = 367 and D = 100 then we have:

((100 × 12) + 373) ÷ 367 = 4.2861035…

which gives a final answer of 4. Thus day 100 is in April. These were not the actual number of stones; in fact there were fewer than 250 blue stones. How many stones were there in each of the three piles?


Enigma 466: Golden sum

From New Scientist #1617, 16th June 1988 [link]

Recently, I gave a talk on puzzles to the Mathematics Society of Goldsmiths’ College, and so this puzzle is dedicated to the students and staff in the society.

In the following addition sum, different letters stand for different digits. Also, I is greater than S.

Enigma 466

What is the sum?


Enigma 462: The cricket mystery

From New Scientist #1613, 19th May 1988 [link]

Our local cricket club consists of 11 married couples with surnames, Ashes, Bowler, Cricket, Declare, Eleven, Fielder, Googly, Hit, Innings, Join-at-the-wicket, and Kit. Recently there have been complaints that cricket balls have been hit out of the ground into local gardens. It was known that, in each couple, only one partner is capable of hitting the ball out of the ground.

On the last practice evening, 11 balls were hit out of the ground. From my position I could only tell, each time, that the hitter was one of a group of players, for example, the first ball hit out was hit by Mr Declare or Mrs Eleven or Mrs Hit. The full list was as follows:

1. Mr D, Mrs E, Mrs H;
2. Mrs B, Mrs F, Mrs J, Mr K;
3. Mrs A, Mr F, Mr G, Mr I;
4. Mrs F, Mrs K;
5. Mrs A, Mr C, Mr G;
6. Mrs A, Mr D, Mrs E, Mr F, Mrs G, Mr H;
7. Mrs B, Mrs F, Mr J, Mr K;
8. Mr A, Mr D, Mr F;
9. Mrs C, Mr F, Mrs I;
10. Mr B, Mrs F, Mr K;
11. Mr E, Mr F, Mrs G.

Who could I definitely say had hit a ball out of the ground?


Enigma 1048: Rows and columns

From New Scientist #2204, 18th September 1999 [link]

A square field has its sides running north-south and east-west. The field is divided into an 8 × 8 array of plots. Some of the plots contain cauliflower. A line of plots running west to east is called a row and line of plots running north to south is called a column.

John selects a row and walks along it from west to east, writing down the content of each plot as he passes it; he writes E to denote an empty plot and C to denote a plot containing cauliflower; he writes down EECECCEC. He repeats this for the other seven rows and writes down ECEECCCE, ECECEECC, ECCECCEE, CEECEECC, CECECECE, CECCECEE and CCECEEEC. The order in which John visits the rows is not necessarily the order in which they occur in the field.

Similarly, Mark selects a column and walks along it from north to south, writing down the content of each plot as he passes it; he writes down EECECCCE. He repeats this for the other seven columns and writes down EECCEECC, ECECECEC, ECCECEEC, CEECCECE, CECECECE, CCEEECEC and CCECECEE. The order in which Mark visits the columns is not necessarily the order in which the occur in the field.

Draw a map of the field, showing which plots contain a cauliflower.

Enigma 1248 was also called “Rows and columns”.


There are now 1200 Enigma puzzles on the site (although there is the odd repeated puzzle, and at least one puzzle published was impossible and a revised version was published as a later Enigma, but the easiest way to count the puzzles is by the number of posts in the “enigma” category).

There is a full archive of Enigma puzzles from Enigma 1 (February 1979) to Enigma 461 (May 1988), and of the more recent puzzles from Enigma 1048 (September 1999) up to the final Enigma puzzle, Enigma 1780 (December 2013). Which means there are around 591 Enigma puzzles to go.

Also on the site there are currently 53 puzzles from the Tantalizer series, and 50 from the Puzzle series, that were published in New Scientist before the Enigma series started.

Happy Puzzling!


Enigma 1051: Win on average

From New Scientist #2207, 9th October 1999 [link]

The top of the hockey league table looks like this:

All other teams have less than 8 points. There is just one match to play, Oldies v Housians.

There are 2 points for a win and 1 for a draw. Teams that are level on points in the table are ordered by their goal averages, that is, their “goals for” divided by their “goals against”. Teams with the same points and averages are ordered by drawing lots.

There are six different orders that the teams can finish in: HOW (that is, H first, O second and W third), HWO, OHW, OWH, WHO and WOH. An order is unexceptional if there are more than 100 different scores in the the Oldies v Housians game which would produce that order.

Which of the six orders are unexceptional? For each of the other orders, state how many different scores would produce that order without drawing lots.


Enigma 458: The brownies wrap things up

From New Scientist #1609, 21st April 1988 [link]

Our local brownie pack is divided into five teams — red, blue, green, yellow and purple. Each team contains at least one and not more than six brownies. Recently the were due to visit the old people’s home and Brown Owl suggested they should make some gifts and wrap them in coloured paper. What each team had to do depended on how many were in the team; for example, if a team contained one brownie then the team had to make two blue presents and one yellow present. The full list of instructions was as follows:

If 1 in the team then make 2 blue and 1 yellow;
If 2 in the team then make 1 red and 3 yellow and 1 purple;
If 3 in the team then make 2 red and 1 blue;
If 4 in the team then make 1 green and 1 yellow;
If 5 in the team then make 1 blue and 1 green and 2 yellow and 1 purple;
If 6 in the team then make 1 red and 1 green and 1 purple.

When the brownies had finished, Brown Owl found that, for each colour, the total number of presents of that colour was equal to the number of brownies in the team of that colour; for example, the number of red presents was equal to the number of brownies in the red team.

How many brownies were there in each team?


%d bloggers like this: