Enigmatic Code

Programming Enigma Puzzles

Tag Archives: by: Keith Austin

Enigma 538: Rule of the road

From New Scientist #1690, 11th November 1989 [link]

I recently visited Ruralania with its five towns, Arable, Bridle, Cowslip, Dairy, Ewe, joined by one-way roads labelled high or low, as in the map:

Enigma 538

The Ruralanian road system is very simple; if a driver is at one of the five towns then the systems says whether he or she is to leave that town by the high road, by the low road, or to stop in that town.

The system is determined by the fact that it must be possible to make a Grand Tour by starting at a certain town and driving round visiting all the towns and stopping at the final town, while always obeying the single Rule (X):

Take the high road if taking the low road and then obeying Rule (X) again, results in your car next being at A or E. Otherwise, take the low road if taking the high road and then obeying Rule (X) again, results in your car next being at C. Otherwise, stop in the town where you are.

What is the Grand Tour? (List the towns in order).


Enigma 973: Choss, anyone?

From New Scientist #2128, 4th April 1998

The game of choss is played by two players, Black and White, on a board of 6 × 6 squares. Each player has a number of pieces which he or she moves one square horizontally or vertically. The players take it in turns to move one of their own pieces. A piece cannot move into a square already occupied by a piece of the same colour. If a piece moves into a square occupied by a piece of the opposite colour, that the other piece is captured and removed from the board. One White piece is larger than the other pieces and is called the Target. Black wins by taking the Target.

The layout of the board is as shown and it is Black’s move. She can in fact definitely win in three or fewer moves.

1. What should the first of these moves be?

That was the Enigma that I intended to set, but the editor thought it was too easy. He suggested that I change the board layout above by moving the Target to some other unoccupied square where it cannot be immediately taken by Black, but so that from the new layout Black can again definitely win in three or fewer moves. He then suggested that I asked Question 1 about this new layout.

Of course I shall have to choose the new position of the Target so that Question 1 has a unique answer.

2. To which position should I move the Target?


Enigma 975: Ant goes for a walk

From New Scientist #2130, 18th April 1998

Imagine an 8 × 8 chess board and imagine that in each square of the board there is written one of the following four instructions:

Turn right;
Turn left;
Go straight ahead;
Go back.

An ant is placed at the centre of the bottom left corner square. She walks, parallel to the bottom edge of the board, until she reaches the centre of the next square. She reads the instruction in the square she is in and sets off walking in the direction specified by that instruction. She walks in a straight line until she reaches the centre of a square or until she walks off the board; in the latter case, her walk stops. She continues her walk in this way, from square to square, obeying the instruction each time. She walks until she reaches the top right corner square, or she walks off the board; when either happens, her walk stops. In the former case it is called a successful walk.

Answer each of the following questions, “Yes” or “No”.

1. Is it possible to find a successful walk in which the ant repeats some part of her walk?

2. Is it possible to find a walk in which the ant does not repeat the first part of her walk but does repeat some part of her walk?

3. Is it possible to find a successful walk in which the ant visits the top left-hand corner square of the board more than once?

4. Suppose now that the board is 4 × 4. Is is possible to write an instruction in each square, using each of the four different instructions four times, so that the ant’s walk visits every square of the board at least once?


Enigma 534: Under and over

From New Scientist #1686, 14th October 1989 [link]

The important C.A.R. Rally has just been held at Bun’s Hutch, where the track is as in the map.

Enigma 534

There were 12 cars in the rally, numbered 1 to 12. For the start at 10:00, the cars took up the 12 lettered positions on the map, one car to each position. At 10:01 the cars all reached their first bridge, going under or over; at 10:02 the cars all reached their second bridge.

I had taken a photo at 10:01 and also at 10:02. Each photo showed all the numbers of the cars and so each bridge showed a fraction with one number over another. On one photo the fractions worked out to be 1/2, 2/3, 2/3, 2 1/3, 4, 5 1/2, and on the other 2, 2, 2, 3, 5 1/2, 7, but I forget which photo was which.

Which cars started at each of the 12 letters?


Enigma 977: Walk and drive

From New Scientist #2132, 2nd May 1998

Anne, Barbara and Christine walk at 4 mph and drive at 48 mph. They have a journey of 24 miles to do but their car only takes 2 people. So Anne sets off walking, while Barbara drives so far with Christine, who then gets out and walks the rest of the journey. Barbara drives back until she meets Anne, picks her up and the drive the rest of the journey. They choose Christine’s dropping place so as to minimise the time taken by the last person to arrive.

1. How many minutes did the last person take for the journey?

Donald, Eric and Frank have to make a journey of 265 miles. They each walk at a speed which is a whole number of mph and the speed of their 2-seater car is a whole number times their walking speed and is less than 50 mph. They use the same plan as the ladies. The last person to arrive takes an odd number of hours for the journey.

2. How many hours did the last person take for the journey?


Enigma 530: Sudden death

From New Scientist #1682, 16th September 1989 [link]

There were eight players in the Greenchester Knock-Out Golf Championship. Unfortunately, due to rain, the whole competition had to be played on Saturday afternoon, and so it was decided to play the four first-round matches, the two semifinals and the final as sudden-death matches.

Thus in each match the two players played one hole and, if the scores were different, then the lower was the winner of that match. If the scores were equal then the played another hole with the same procedure applying, and so on, until the winner of that match was found.

After the competition the organiser listed each player’s scores for the holes (s)he had played, in order. Unfortunately he did not indicate the number of holes played in each round, but ran the scores together in a single list, as follows:

Anne: 3,3
Bern: 4,2,3,4
Chris: 4,2,3,3,3,3,3,3,2
Donald: 3,2,3,3,3
Eric: 4
Frances: 4,2,3,3,4
Grace: 3,2,3,4
Harriet: 4,2,3,3,2,4

Who beat whom in the semifinals?


Enigma 980: Near and fair

From New Scientist #2135, 23rd May 1998 [link]

Mary stood at the side of a large pile of turnips, which she was to distribute evenly between the needy people of the area, who were standing in front of her. The rule was that if the turnips did not divide evenly between the people that Mary should go to the nearest sensible division. (If necessary, extra turnips could be added or spare turnips disposed of). Quickly, she divided the number of turnips by the number of people and found the answer was between 99 and 100, and nearer to 99. As she knew that 100 turnips would be better for people’s health she decided to carry out the division in a special way.

She announced: “Suppose everyone get 99 turnips. I have the divided the number of turnips by 99”, and she gave the answer to lots of decimal places. “Now, suppose everyone gets 100 turnips. I have divided the number of turnips by 100”, and she again gave the answer.

“If we look at our two answers, then we find that the one that is nearer to the actual number of people is when everyone gets 100 turnips. So, by the rule, that is what everyone will get”.

The distribution did not take long as there were fewer than twenty thousand turnips in the pile.

How many people were there to receive turnips, and how many turnips were there in the pile?


Enigma 526: Ewe to move

From New Scientist #1678, 19th August 1989 [link] [link]

Each of the four fields at Sunny Meadows Farm contains some sheep and some cows. On the gate of each field is hung a sign saying what fraction of the animals in that field are sheep. The signs are 1/2, 1/3, 2/3, 1/4.

Farmer Gillian explained that if she exchanged the signs on [any] two of the fields then, by simply moving some sheep from one of the two fields to the other, she could return to a situation where each sign again correctly indicated the fraction of the animals that were sheep in that field.

As I walked round I noticed that the total number of animals on the farm was between 300 and 350.

How many sheep, and how many cows, were on the farm?

I added the “any” in square brackets, as without it there are many solutions to the puzzle.


Enigma 984: Answers on the back

From New Scientist #2139, 20th June 1998 [link]

I have 8 cards and each card has a whole number on the back. Not all the 8 numbers are the same. On the front of each card there is a true statement about the number on the back of the car. The eight statements are as follows:

“The number on the reverse of this card is…
… 2 plus the number of cards with an even number on them;
… the total of the 8 numbers, divided by 5;
… the number of cards with a prime on them;
… the number of cards with a number larger than 3 on them;
… the difference between the largest number on the cards and the second largest number on the cards;
… the difference between the smallest number on the cards and the second smallest number on the cards;
… the number of cards that have the largest number on them;
… the difference between the number of cards that have the smallest number on them and the number of cards that have the second smallest number on them.”

When a statement refers to a number on a card it means the number on the back of the card. And an extra clue, which you do not actually need, is that if card A has a higher number on it than card B then card A comes before card B in the above list of statements.

What are the 8 numbers on the cards? Give them in descending order.


Enigma 988: Cards high and low

From New Scientist #2143, 18th July 1998 [link]

Benjamin and Matthew have a new card game involving 50 cards numbered 1 to 50. They deal out the cards and Matthew finds he has 1 to 16 and 36 to 44. The game consists of 25 rounds. In each round one player places one of his cards face-up on the table and then the other places one of his face-up on the table. The one who has played the higher card wins that round; the two cards on the table are discarded. For the first round the players toss [a coin] to see who goes first, but after that, each round is begun by the winner of the previous round.

Benjamin and Matthew are both experts at the game and each plays so as to win as many rounds as possible.

(1) How many rounds does Benjamin win?
(2) For the next game Matthew has 1 to 7 and 16 to 33. How many rounds does Benjamin win?
(3) For the final game Matthew has 1 to 8 and 30 to 46. How many rounds does Benjamin win?


Enigma 521: Changing truths

From New Scientist #1673, 15th July 1989 [link]

As I made my way through the jungle with my truthful guide Lamoura, we came upon a clearing, at the centre of which was a large stone. On the stone were carved the following four sentences:

(A) B is true today and C and D are false today, and D is moon.
(B) An even number of A, B, C, D are false today or C is moon.
(C) B is true today and A and D are false today, and B is moon.
(D) B is true today and A and C are false today, and A is moon.

Lamoura explained that beginning on the morrow and running for the next few days was the festival of the Green Moon. So we decided to camp there until the festival was over.

Lamoura told me that on each day of the festival, each of the four sentences is true or false; she also explained that to say that a sentence is moon means that on at least one day of the festival the sentence is true and on at lease one day it is false.

As each day of the festival dawned, a local native gave me a piece of paper stating which sentences were true that day and which were false. I kept these papers and at the end of the festival, I was able to check that what was written on them agreed with what Lamoura had told me. I also noticed that no two papers said the same thing.

How many days did the festival last, which sentence or sentences were true every day, which were false every day, and which were moon?


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 [link]

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?


%d bloggers like this: