# Enigmatic Code

Programming Enigma Puzzles

## Puzzle 3: Letters for digits

From New Scientist #1053, 2nd June 1977 [link]

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

Write the sum out with numbers substituted for letters.

[puzzle3]

## Enigma 539: Letters into letters

From New Scientist #1691, 18th November 1989 [link]

In the following division sum each letter stands for a different digit:

Rewrite the sum with the letters replaced by digits.

[enigma539]

## Puzzle #48: Seeing red

From New Scientist #3271, 29th February 2020 [link] [link]

The traffic lights near me are annoying: they are green for just 10 seconds and red for 90 seconds. I go through them only on green on my bike every day and I first see the lights as I approach around a bend when I am 15 seconds away. I get upset if I miss a green light that I could have got through. I can speed up by about 25 per cent or I can slow down.

What should my strategy be if the lights are green when I first see them? And what if they are red? And how often might I get upset?

[puzzle#48]

## Enigma 971: Squares from 1 to 9

From New Scientist #2126, 21st March 1998

Harry, Tom and I were trying to find a two-digit perfect square, a three-digit perfect square and a four-digit perfect square, such that each of the nine digits from 1 to 9 was used once.

We each found a different valid solution. Both Tom and Harry found the only valid solution for their two-digit squares. Our solutions had no squares in common, but our two-digit squares were consecutive.

List in ascending order the perfect squares used in my solution.

[enigma971]

## Tantalizer 411: Diplomatic niceties

From New Scientist #961, 7th August 1975 [link]

When H.M.G.’s five top ambassadors all fell under the same bus, there was an immense fuss about their replacements. The corridors of power hummed with insinuations, until at last a list of five names and a set of conditional agreements was achieved. The latter read:

1. If Sir Basil Brace does not get Paris, Sir Emlyn Entry shall have Bonn or Rome.
2. If neither Sir Ambrose Amble nor Sir Donald Duck gets Washington, Sir Crispin Carruthers shall have Paris.
3. If Sir Ambrose Amble does not get Bonn, Sir Crispin Carruthers or Sir Emlyn Entry shall have Paris.
4. If Sir Donald Duck does not get Rome, then, if Sir Ambrose Amble does not get Paris, Sir Emlyn Entry shall have Moscow.
5. If Sir Ambrose Amble does not get Washington, then, if Sir Donald Duck does not get Moscow, Sir Crispin Carruthers shall have Bonn.

Having been duly warned that “if x then y” does not mean or imply “if not x then not y”, can you assign the top chaps to the right places?

[tantalizer411]

## 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:

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

[enigma538]

## Puzzle #47: Geometra’s tomb

From New Scientist #3270, 22nd February 2020 [link] [link]

Long before the invention of satnav, the great explorer Asosa Lees embarked on a trek across the square desert of Angula in a quest to find the lost tomb of Geometra, which lay somewhere along the line marked A.

Lees had nothing but the crude and incomplete diagram shown and some basic instructions: proceed south-west for 100 kilometres, and then turn left. The only other information she had was that at the moment she turned left, the distance to the south-west corner of the desert was 100 kilometres further than the distance to the south-east corner.

To reach the tomb, Lees needed to head in precisely the right direction. Fortunately using her knowledge of geometry she was able to take the correct bearing.

At what angle did she head off towards the tomb?

[puzzle#47]

## Enigma 972: Fifty-fifty

From New Scientist #2127, 28th March 1998

Bunko, Jack and Patience have a pack of cards that consists of fewer than one hundred cards which are numbered consecutively: 1, 2, 3, 4, 5, 6, …

On one occasion recently they were each given one of the cards (without the other two players seeing which).

Bunko said: “There’s an exactly 50:50 chance that my card is the highest of our three”.

Then Jack added: “In that case there’s an exactly 50:50 chance that, in decreasing order, the cards are Bunko’s, Patience’s then mine”.

How many cards are there in the pack? And what was Jack’s card?

[enigma972]

## Puzzle 4: Football (4 teams. Old method)

From New Scientist #1054, 9th June 1977 [link]

Four football teams, A, B, C and D, are to play each other once. After some — or perhaps all — of the matches have been played a table giving some details of matches played, won, lost, etc, looked like this:

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

Find the score in each match.

[puzzle4]

## Enigma 537: The three sisters

From New Scientist #1689, 4th November 1989 [link] [link]

Sarah, Tora and Ursula are three sisters. One of them is honest, one always lies, and the third is simply unreliable.

Tora told me that the youngest of the three is fatter than the liar, and the oldest of the three told me that the fattest is older than the honest one. But Ursula and the thinnest sister both agreed that the oldest sister always lies.

The fattest sister and the oldest sister both agreed that Sarah always lies. Then the youngest sister whispered to Sarah who then claimed that the youngest had said that Ursula was the fattest.

Who is the honest sister?
Who is the fattest sister?
Who is the youngest sister?

[enigma537]

## Puzzle #46: Pi-thagoras

From New Scientist #3269, 15th February 2020 [link] [link]

Pythagoras’s theorem says that for any right-angled triangle, the square of the hypotenuse (the longest side of the triangle) is equal to the sum of the squares of the other two sides.

There are some right-angled triangles whose sides are all whole number lengths. The simplest and best known is the “3-4-5” triangle (3² + 4² = 5²).

I have drawn a circle that fits precisely inside a 3-4-5 triangle. What is the area of the circle? Have a guess. And then see if you can prove that you are right.

[puzzle#46]

## Enigma 973: Choss, anyone?

From New Scientist #2128, 4th April 1998 [link]

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?

[enigma973]

## Tantalizer 412: Consider your verdict

From New Scientist #962, 14th August 1975 [link]

While waiting for the judge to settle his wig, sharpen his quill and pump up his cushion, each member of the jury wondered how the 11 others would vote when it came to the point. Here are their predictions in alphabetical order:

Juror A thought all the others would favour acquittal.

Juror B thought all the others would be for convicting.

Juror C thought exactly one of the others would want to convict.

Juror D thought exactly one of the others would want to acquit.

Juror E thought exactly 10 of the others would want to convict.

Juror F thought exactly 3 of the others would want to acquit.

Juror G thought exactly 8 of the others would want to convict.

Juror H thought exactly 7 of the others would want to acquit.

Juror I thought exactly 4 of the others would want to convict.

Juror J thought exactly 8 of the others would want to convict.

Juror K thought exactly 3 of the others would want to acquit.

Juror L thought exactly 9 of the others would want to convict.

In the event all those whose predictions were incorrect voted for one verdict, whereas those (if any) whose predictions were correct voted for the other.

Which jurors favoured acquittal?

A correction (applied to the text above) was published with Tantalizer 416.

[tantalizer412]

## Enigma 536: A strange encounter

From New Scientist #1688, 28th October 1989 [link] [link]

At a Halloween party I met a strangely beautiful red-haired woman who was gazing with longing into a bonfire. To my inquiries she replied: “(My telephone number) 2 = AABCCD and the exchange is 04617. I was born in the year given by: (AE) F = EDGE”

I realised that it was one of those ‘letters-for-digits-and-digits-for-letters’ puzzles, but I must have looked confused for she added: “The other letters are HIS.” So saying she vanished into thin air.

Given that in the above relations the same letter stands for the same digit and the same digit stands for the same letter; that different digits stand for different letters and vice versa; and that 04617 stands for the place where she now resides:

Can you solve the mystery and write down the digits 0 to 9 in the alphabetical order of the letters that represent them?

[enigma536]

## Puzzle #45: Beetles on a clothes line

From New Scientist #3268, 8th February 2020 [link] [link]

Peg beetles are a rare species with rather odd behaviour. As any peg beetle expert will know, these beetles always walk at 1 metre per minute, and when two beetles meet, they immediately reverse direction.

Six peg beetles are on a 2-metre-long clothes line, some walking left to right and others right to left (as the diagram shows). As we join the action, beetle A is at the left-hand end of the line and walking towards the right, while beetle F is at the right-hand end, walking left.

When a beetle reaches the end of the clothes line, it drops off onto the ground.

Which two beetles will be the last to drop off the clothes line, and how long will it be before that happens?

[puzzle#45]

## Enigma 974: Girls jump first

From New Scientist #2129, 11th April 1998 [link]

Each pony club competing at the gymkhana entered one boy and one girl for the showjumping. In order to determine the order of competition, Mary put all the riders’ names in a hat and drew them out one at a time.

When Mary had drawn precisely half of the names she was surprised to find she had drawn one rider from each club. She calculated that if she did such a draw a thousand times this would only be likely to happen with this number of competing clubs on three occasions (to the nearest whole number). She then realised in amazement that the riders she had drawn in that first half were all the girls.

1. How many clubs were competing?
2. If the number of clubs competing is still as in question 1, on how many occasions (to the nearest whole number) would Mary be likely to draw all the girls first if she carried out the draw five million times?

[enigma974]

## Puzzle #44: Elevator pitch

From New Scientist #3267, 1st February 2020 [link] [link]

On the way back from a party the other day, my daughter and I got into an elevator. I was holding a cup of water with an ice cube floating in it, while my daughter was admiring her helium-filled balloon as it floated above her on a slack string. Our only company in the elevator was a spider, dangling from the lift’s ceiling on a thin thread of silk. As the lift accelerated upwards, what did we see happening to the balloon, the ice cube and the spider?

[puzzle#44]

## Puzzle 5: “I would if I could”

From New Scientist #1056, 16th June 1977 [link]

“I would if I could, but I’m sorry I can’t.”
I felt that I had to say this to my Aunt.
She seemed to expect me to lend her some cash.
And knowing my Aunt that would surely be rash.
I happen to know what her overdraft is;
My Uncle’s is large, hers is much more than his.
Her husband, my Uncle, in fact owed the bank
A number of pounds which was, let’s be frank,
Sixty-three more than my overdraft then.
Aunty’s and mine are two-hundred-and-ten;
Between them, I mean, and I’d like you to see,
When I say “much”, Aunt’s is Uncle’s times three —
Or as near to three as it can be,
Bearing in mind this vital fact:
The pounds we owe are all exact.

What are the overdrafts of my Aunt, my Uncle and myself.

This puzzle was later re-published as Enigma 182.

[puzzle5]

## Enigma 535: For old time’s sake

From New Scientist #1687, 21st October 1989 [link]

“What time is it dear?” asked old Mrs Protheroe, from her wheelchair. “Is it time for the evening news yet?” Her husband pulled the watch, on the end of its chain, from his waistcoat pocket. “Drat! It’s stopped; I must have forgotten to wind it up last night.”

“That’s no cause for you to use such strong language,” snapped his wife. “Anyway, Joanna has left her watch on the sideboard. Perhaps that’s working.”

Mr Protheroe picked up his grand-daughter’s watch and stared at it. Now he was what one might call old-fashioned: he had no truck with modern contraptions, like digital watches. His brow furrowed in concentration as, for the first time in his life, he tried to decipher the strange looking figures on the face of the watch. He turned it first one way, then the other, until, with a triumphant “Ah!”, he announced the correct time to his wife.

What Mr Protheroe did not realise was that:

(a) He was holding the watch upside-down;
(b) The watch was 21 minutes slow.

Nevertheless, the time he announced was the correct one.

What time was it?

[enigma535]

## Enigma 975: Ant goes for a walk

From New Scientist #2130, 18th April 1998 [link]

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?

[enigma975]