Enigmatic Code

Programming Enigma Puzzles

Tantalizer 335: Pocket money

From New Scientist #886, 21st February 1974 [link]

Teddy and his brothers have set their hearts on a paint-box, a fire-engine, and a space-gun. So, when they received 20p each for digging the garden recently, each earmarked a different whole number of pennies for each toy. (I mean that each divided his 20p differently, not that no two boys allocated the same number [of pennies] to one toy).

Each, alas, fell far short of the sum needed. But then they had the happy idea of pooling resources. Each had devoted his largest sum to the space-gun which came to 52p in total, and, hooray, the gun cost 52p … Each had earmarked his smallest sum for the paint-box and that total too exactly bought it. Similarly they also had exactly enough for the fire-engine.

If I just add that Teddy’s 3p was the smallest contribution to anything, can you work out the price of the fire-engine?


Enigma 871: Pandigitals

From New Scientist #2026, 20th April 1996 [link]

Uncle Joe had written the digits 0 to 9 on ten cards, some red, the others blue, one digit per card. “Now boys,” he said, “you have to arrange the red cards on the table to form a number, and divide the blue cards into two groups to form two separate numbers. The ‘red’ number must be the product of the ‘blue’ numbers.”

“Like this?” said Tom. “Or this?” said Dick. “Or this?” said Harry.

“All different, and all correct!” replied Uncle Joe.

Only Tom had included a single-digit number in his arrangement. What was Harry’s ‘red’ number?


Puzzle #135: You don’t know jackpot

From New Scientist #3356, 16th October 2021 [link] [link]

I figured something was wrong with the slot machine in Pete’s Gas Station when I saw the peeling paint on top. But I knew for certain when I put in 50 cents, got three 7s, and nothing came out.

There are three possible symbols: cherries, a melon and a 7. It should have given me $5 for all three 7s, $2 for two 7s, and $1 if only the rightmost symbol was a 7.

“Oh, it’s fine”, said Pete. “Three 7s was the old jackpot setting. I’ve got the new jackpot written down… it’s here somewhere”. While he was searching, I saw a woman play five times and get the following:

“House always wins”, she muttered before leaving. Pete wandered in: “Sorry, can’t seem to find it”. “No problem”, I said, “I think I’ve got it”.

What is the jackpot setting?


Enigma 643: Battery failure?

From New Scientist #1797, 30th November 1991 [link]

Enigma 1701

My nephew thought that his calculator was faulty, and he asked me to check it. He typed in one two-figure number times another two-figure number: I didn’t see him press the keys, but I saw two numbers displayed, followed by a four-figure answer. I then did the calculation on a piece of paper to check the answer, and found to my surprise that I got the same answer which I had seen on the calculator — except that the middle two digits were reversed.

To see if the calculator always made this sort of mistake, I tried a few more calculations for myself. I soon found that the calculator was doing all its calculations perfectly, but that its display was faulty. Whereas it normally displayed each of the digits by lighting up some of the seven strips that make up the number 8 (as illustrated above), one of these seven strips never lit up for any digit. The result was that although a couple of digits looked most peculiar, most digits were unaffected and some digits looked like others.

(I can also tell you, although strictly you don’t need to know, that one of my nephew’s original two-figure numbers had in fact been displayed correctly and the tens digit of the other number was also displayed correctly).

What was the four-figure product which I correctly calculated on the piece of paper?


Tantalizer 336: East and west and south and north

From New Scientist #887, 28th February 1974 [link]

Lars Porsena of Clusium
By the nine gods he swore
That the great house of Tarquin
Should suffer wrong no more.
By the nine gods he swore it
And named a trysting day
And bade his messengers ride forth
East and west and south and north
To summon his array.

And thereby hangs a tale. There were six messengers on the staff but two were tight and could not go.

East and west and south and north. The historian Poppigallus names them as Amnis, Brutus, Casca and Delius respectively; thus mention just two of the right names, neither attached to the right direction. His colleague Quidnunc gives Delius, Erebus, Flavius and Brutus respectively — also just two of the right names but one of them assigned to the right direction. Rhadamanthus does better, listing Flavius, Amnis, Delius and Casca respectively and so naming three correctly, of whom one is assigned to the right direction.

Only the historian Taradiddlus is wholly right. What is his list?


Unplanned outage

Apologies for the outage of Enigmatic Code between 08:15 UTC 11th October 2021 and 05:48 UTC on 12th October 2021.

This was due to WordPress.com suspending the site without giving any warning or reason. I immediately contacted them to get the site reinstated.

WordPress.com has now reinstated the site, and apologised for the mistake and any inconvenience caused. Apparently the suspension was due to an automated spam detection system.

It seems an odd way to celebrate the 10th anniversary of the site (coming up in November 2021), but normal service will now resume.

I suppose this is one of the perils of using a free hosting service in order to provide the site for free. But for the most part WordPress.com has performed quite well over the last 10 years, the last couple of days notwithstanding. However I am always interested to hear about other hosting options that may provide a better environment for the site.

Enigma 873: Prime time

From New Scientist #2028, 4th May 1996 [link]

This is another of those letters-for-digits Enigmas, where each digit is consistently replaced by a letter, different letters being used for different digits. I can tell you that

NINE is divisible by 9;

EIGHT is a perfect cube; and

PRIME is prime.

Playing about with prime numbers can take ages, but with aid of a calculator and efficient thinking you can, within ten minutes tell me what TEN is.


Puzzle #134: No time to try

From New Scientist #3355, 9th October 2021 [link] [link]

James Blond edges along the corridors of the supervillain’s base, and comes to two locked doors, each with a keypad that requires a four-digit code. He will need to get through one of the doors, but there is no time to guess a four-digit code — the number of possible combinations is staggering!

But wait! Some of the buttons on the keypads are visibly worn down, while others look as if they have never been pressed.

One door has a keypad with four worn buttons, the other has three. Blond only has time to try one door, and he will have to try all the possible combinations.

Which of the two keypads will give him fewer combinations to try — the one with four worn buttons, or the one with three?


Enigma 642: Fibonacciesque

From New Scientist #1796, 23rd November 1991 [link]

My children had been practising addition, forming additive sequences of numbers, and when the numbers got too large for them, extending the sequence the other way using subtraction and getting some negative numbers. Eventually, they noticed that one of their sequences had numbers in it divisible by 2, 3, 5 and 7 but none divisible by 11. Part of that sequence was:

…  –2  3  1  4  …

the rule going from left to right being, of course, that one term plus the following one gives the next.

The children soon saw too that every sequence they wrote down had terms divisible by 2 and 3, and probably 7 also.

What I want you to find is the two sequences like this, each having no terms divisible by 5, 11 or 13. In each sequence the four consecutive terms we want should have:

just the first term negative;
the third term 3;
and the fourth term less than 100.

(In fact, one of the sequences will have terms divisible by 17 and none divisible by 19, while the other will have terms divisible by 19 and none divisible by 17, but you don’t need these facts to find them).

Find the four terms of the two sequences.


Tantalizer 337: Tracks for home

From New Scientist #888, 7th March 1974 [link]

Professor Probe has been collecting sympathetic snails. He recently put four pairs out on his verandah (which is a 6 × 6 square of paving stones) at the junctions marked with the two members of each pair.

One of each pair promptly went into its shell and stayed there, while the other promptly crawled over for company. Each crawled on on the lines around the squares, leaving a fine slimy track and no tracks touched or crossed.

Can you plot the four routes?


Enigma 875: Oh Hell!

From New Scientist #2030, 18th May 1996 [link]

We play a card game called “Oh Hell!”. In the first round eight cards are dealt to each player, in the next round seven each, and so on, until in the eighth round each player gets just one card.

Then in each round each player looks at his or her cards and predicts how many “tricks” he or she will get when the cards are played in a whist-type fashion. At the end of each round each player gets the number of points equal to the number of tricks he or she has won plus a bonus of ten points if their prediction was correct.

Players keep their own scorecard, and here is an example of a recent one of mine, giving me a total of 56:

Enigma 875

In another game my total after five rounds was again 41, and again my final total was even, but I noticed that the eight “totals so far” were all different two-figure numbers such that the reverse of any one of the “totals so far” was another of the “totals so far”.

What was my final score?


Puzzle #133: Think tank

From New Scientist #3354, 2nd October 2021 [link] [link]

Toddler Tina has noticed that Sticky, her stickleback, is struggling because the water in the slim fish tank is only 2 centimetres deep. She would like to top up the tank with water, but the tap is beyond her reach, so she has the bright idea of dropping one of her toy bricks into the tank instead.

Fortunately, the brick misses the fish, and the water level rises to become exactly level with the height of the brick, which is lying flat. The brick is twice as long as it is wide, and three times as long as it is high. The interior of the tank is one-and-a-half times as long as the brick, but only two-thirds as wide as the length of the brick.

What are the dimensions of Tina’s toy brick?


Enigma 641: Cabinet padding

From New Scientist #1795, 16th November 1991 [link]

“Nepotism has reached new heights in Utopia,” grumbled my friend in his latest letter. “The Cabinet now consists of the Prime Minister, his three sons (no daughters, thank goodness), Boris, Maurice and Horace; his brother; his three nieces (the brother’s daughters), Rita, Vita and Zita; and the Minister of Farriers and her son, Dieter, and daughters, Anita and Beata.

“The twelve sit around a round table in alphabetical order of appointment. This we have, going clockwise from the PM, the Ministers of Farming, Farriers, Fencing, Ferrymen, Finance, Fisheries, Food, Football, Footwear, Foreigners and Fuel at one o’clock, two o’clock and so on. It is also the case that:

1. The PM sits between a husband (one of his sons) and wife (one of his daughters-in-law) and opposite one of his nieces.
2. Cousins may not marry in Utopia.
3. Doris sits between her daughters.
4. Anita is engaged to Horace.
5. Boris, a confirmed bachelor, sits between a husband and a wife.
6. The Minister of Football is Peter’s son-in-law.
7. The Minister of Fisheries is unmarried.
8. Zita sits opposite her father.
9. Vita sits next to her father.”

Can you give the name of each of the ministers?


Tantalizer 269: The last trumps

From New Scientist #820, 16th November 1972 [link]

Last night’s final hand at bridge was a tricky one. Reckoning 4 for an ace, 3 for a King, 2 for a Queen and 1 for a Jack, everyone had 10 points. No one had more than one Queen or both red Aces. South and West were void in the same two suits. The King and Queen of clubs were in different hands and so were the King and Queen of diamonds. North had no Kings, and South had no Jacks. East did not hold the Jack of hearts.

Spades were trumps. Who held which of the top four?

This puzzle reappeared as Tantalizer 387.

This puzzle was selected for the book Enigmas (1982), by Robert Eastaway.


Enigma 874: Scamelot lottery

From New Scientist #2029, 11th May 1996 [link]

To enter the Scamelot lottery you have to scratch off any six numbers from a scratchcard as shown above.

Each week six numbers are chosen by the Scamelot ball-grabber.

Arnie always picks numbers from different rows and different columns. He considers this lucky. Betty thinks prime numbers are lucky and so chooses a random six primes every week. Cher always chooses the same four lucky numbers and then, just for luck, chooses two higher numbers whose sum is equal to the sum of her regular four numbers.

This week, luckily, Arnie, Betty and Cher all share the jackpot.

What numbers were grabbed?


Puzzle #132: One of these days

From New Scientist #3353, 25th September 2021 [link] [link]

Dear class,

I told you that we would have a quiz next week, and many of you have asked on which day it will be given. An understandable question, so I have helpfully provided the answer below.

A: The quiz will be on Friday, or else Tuesday.
B: The quiz will be on either Monday or Thursday.
C: Either statement B or D is false, but not both.
D: Either the quiz is on Monday or Wednesday, or exactly two of statements A to E are true.
E: Either the quiz is on Tuesday or Thursday, or more than two of statements A to E are false.

Hope that helps.

Your favourite maths teacher,

Mr Gordon


Enigma 640: Rally round

From New Scientist #1794, 9th November 1991 [link]

The rally circuit is 100 kilometres round. The rally organiser takes exactly the amount of petrol your car required to drive 100 kilometres, divides it in any way she chooses into a number of cans, and places the cans at various points on the circuit, which looks like this:

The organiser tells you how much is in each can, and where each can is. You select one of the points where a can is; then your car, with no petrol in its tank, is taken to that point. You then have to drive round in the direction of the arrows using only the petrol the organiser has provided. You are not allowed to walk round the circuit to get petrol. The distance you travel before you run out of petrol is measured.

There are two questions:

1. If the organiser arranges the petrol so as to make your job as hard as possible, and you then choose your starting point so as to make your distance as large as possible, how far do you travel?

2. The rules are changed so that the organiser puts out only the amount of petrol your car requires to drive 90 kilometres. Irrespective of how she organised the petrol, can you always select a starting point so that you are certain to be able to travel at least 45 kilometres?


Tantalizer 275: Premonitions

From New Scientist #826, 28th December 1972 [link]

“Methinks I am a prophet new inspir’d”, says John of Gaunt in Act II of Shakespeare’s King Richard II. In the margin against this line in the first folio edition now reposing in the University of Wessex library someone has scribbled in cheap Biro, “So am I. I prophesy that my age on my death will be one twenty-ninth of the year of my birth.”

On the evidence of the handwriting the prophecy is the work of Sir Ambrose Arcane, the noted astrologer. If so, it is yet one more indication of his uncanny powers, since he did indeed die… well, at what age, and in what year?

A variation on this puzzle was published in the book Enigmas (1982), by Robert Eastaway, as follows:

“Methinks I am a prophet new inspir’d”, says John of Gaunt in Act II of Shakespeare’s King Richard II. In the margin against this line in the first folio edition now reposing in the University of Wessex library someone has scribbled in cheap Biro, “So am I. I prophesy that my age on my death will be one thirtieth of the year of my birth.”

On the evidence of the handwriting the prophecy is the work of Sir Ambrose Arcane, the noted astrologer. If so, it is yet one more indication of his uncanny powers.

In the very year predicted, whilst on a pilgrimage to the tomb of the great Tibetan astrologer, Daija Voo, Sir Ambrose tragically contracted smallpox.

In exactly what year, and at what age, was that?


Enigma 876: Short circuit

From New Scientist #2031, 25th May 1996 [link]

We spent our holiday on the oddly-shaped island of Hexonia. One day, we drove around the coast road which was in the form of a hexagon with each angle 120°. I remember noticing that each straight was a different perfect square whole number of kilometres and that the complete circuit was less than 500 kilometres.

How far did we drive?


Puzzle #131: The Paradise Club

From New Scientist #3352, 18th September 2021 [link] [link]

Down at The Paradise Club, Gus and Bart take it in turns to roll a pair of dice. The first person to score his favourite score for two dice wins, which means being treated to a drink by the other (the loser). They each favour a different prime number as a score with two dice and it so happens that their chances of getting their favourite score is the same for each.

What is that probability? If Gus goes first what are his chances of being bought a drink?


%d bloggers like this: