Enigmatic Code

Programming Enigma Puzzles

Puzzle #173: Knight moves

From New Scientist #3392, 25th June 2022 [link] [link]

My son is obsessed with chess, and has been acting out the game’s moves everywhere we go, running like a bishop and jumping like a knight on tiled floors. He was tickled to see that on the number pad of my keyboard he could type 27 using a knight’s move, because the move from 2 to 7 is an L-shape, like a knight moves on a chessboard.

Alas, he can’t make 27 using a bishop move. Bishops move diagonally any number of spaces, so a bishop, using multiple moves, could make a number like 484 or 9157. In a similar fashion, a knight could make numbers such as 167 or 8349.

Yesterday, he made a happy discovery: a three-digit knight number that is exactly 27 more than a three-digit bishop number. (Actually, I found I could put another digit, call it “X”, at the front of my son’s numbers, and still have a knight number that is exactly 27 more than a bishop number).

What numbers did my son find?


Enigma 857: Four cubes

From New Scientist #2012, 13th January 1996 [link]

Harry, Tom and I were challenged to find four perfect cubes, one consisting of one digit, one of two digits, one of three digits and one of four digits, such that the ten digits used included nine different digits. We were allowed to regard 0 as a valid solution for the one-digit cube.

Our solutions were all different. You might say that we each found two solutions, though each of us simply found an alternative for one of our numbers, the other three numbers being common to both solutions. The three numbers common to both my solutions did not appear in any of Harry’s or Tom’s solutions.

Please list those three numbers in ascending order.


Enigma 859: Oh lucky day!

From New Scientist #2014, 27th January 1996 [link]

I have a lucky number. When the numbers of a date add up to the square of my lucky number I call that a “lucky day”. (For example, if my lucky number were 11 then 24/3/94 would be a lucky day since 24 + 3 + 94 = 121). I especially like the lucky days which fall on Sundays.

I once noted the occurrences of my lucky days as they happened over a period of three consecutive calendar years. I had one day each month. Furthermore, there were more lucky Sundays in the first year than in the second, and more lucky Sundays in the second than the third.

What was the date of the first lucky day in that three-year period?


Puzzle #172: Four got it

From New Scientist #3391, 18th June 2022 [link] [link]

Emma Neesha is a forgetful sort, and she has just locked herself out of her house with her keys still inside.

Not to worry, she installed keypads on both her house and car for such occasions. Unfortunately, she has also forgotten the four-digit code to her house.

This shouldn’t be a problem, because she keeps a code clue in her wallet. It says: “Four times the car’s four-digit code”.

Well, that is fine, but she has forgotten that one too. Fortunately, Emma is prepared: she has a clue written down for the car’s code as well. Pulling that one out, it reads: “The reverse of the house code”. Oh dear.

Can you help?


Enigma 858: A matter of degree

From New Scientist #2013, 20th January 1996 [link]

Within the Earth’s atmospheric range, it is not possible to convert any whole number of degrees Fahrenheit into Celsius by reversing the digits. There is a good approximation in the case of 82 °F, which is nearly 28 °C the same may be said for 61 °F and 16 °C, but in neither case is the conversion exact.

It is possible to construct another scale to Celsius, sharing zero as freezing point, but with a different boiling point, which is a whole number berween Celsius’s 100° and Fahrenheit’s 212°, so that there is a positive point on the Fahrenheit scale which may be converted exactly into the equivalent temperature on the alternative scale simply by reversing the two digits.

What is boiling point on the alternative scale, and what is the convertible Fahrenheit temperature?


Enigma 860: Weight for it!

From New Scientist #2015, 3rd February 1996 [link]

I used to run a village shop and I had a pair of scales and a set of 10 weights. Each weight was a whole number of ounces and the total weight was less than 1024 ounces. I found that I could [not] put one or more weights on each of the two pans of my scales so that they balanced.

One day I lost a weight. By chance I was able to replace it with a spare; unfortunately it was not the same weight as the one I lost. However, now I could put one or more weights on each of the two pans of my scales so that they balanced; in fact, I could arrange for each side to weigh 6 ounces. Unfortunately I could not weigh 13 ounces, although I could weigh 3 ounces.

Q1. What was my set of weights after the replacement?

Q2. Suppose I was back with my original set of weights. Could I have selected one and replaced it by some other whole-number-of-ounces weight, of my own choosing, so that the total weight was still less than 1024 ounces and I still could not put one or more weights on each of the two pans of my scales so that they balanced?

Q3. As Q2 but now I can replace six weights instead of just one. The new set of weights must not be the same as my original set.

This statement takes into account the correction to the puzzle published with Enigma 866.

I also added the “not” in square brackets into the text, as without it the puzzle doesn’t make sense to me.


Puzzle #171: The magic number bracelet

From New Scientist #3390, 11th June 2022 [link] [link]

“Here’s your 21st birthday present”, said Amy.

“A bracelet?”, frowned Sam.

“Not just any bracelet, it is a magic number bracelet because I know you love numbers. See how it has got five beads, each with a different positive number on it. You can find all the numbers from 1 to 21. But to find most of them, you have to add together adjacent beads.”

“For example, to make the number 17 you add together these three beads”, she said, pointing to the beads in positions A, B and C on the diagram. “Other numbers are found by adding two, three or four adjacent beads. And, of course, to get 21, you add up all five”.

What are the five numbers on Sam’s bracelet?


Enigma 664: The way of the dove

From New Scientist #1819, 2nd May 1992 [link]

In Churchester there are nine churches of the Angel, of the Bell, of Charity, of Destiny, of Endurance, of Friendship, of God, of Help and of Inspiration. The map of Chuchester shows the nine square parishes and each has its church at its centre. I can only remember where the church of the Angel and the church of Charity are:

There are nine doves in Churchester and each one visits three churches, flying around in a triangle in a clockwise direction. For example, one dove flies from Help to Bell, to Charity, and then back to Help again. The routes of the doves are HBC (the one just mentioned), DAF, BGI, GEA, HID, CEF, CAI, BED and FHG.

Complete the map of Churchester.


Tantalizer 270: Cupid’s arrow

From New Scientist #821, 23rd November 1972 [link]

With eight handsome bachelors and eight ravishing spinsters in the office, prospects look bright for matrimony. The snag is, however, all are fanatical Catholics or Protestants and the chances against a random bride and groom being of the same religion are nine to seven. In a random mixed marriage, the groom would probably not be a Catholic, even though there are more Catholic men than Protestant women.

How many of the 16 are Protestants?


Enigma 662: State of the parties II

From New Scientist #1817, 18th April 1992 [link]

As you can see from my friend’s latest letter, there’s been a general election in Utopia too:

“You will recall that the state of the four parties after the 1989 election was Sinistrals 289, Dextrous 243, Others 36, Indeterminates 32. This remained the case right up to the breakup of the ruling coalition last month, when new elections to the Scitting were held. This time the following occurred:

1. The Sinistrals finished with more seats, the other three parties with less.

2. The Sinistrals lost an equal number of seats to each of the other three parties and gained some seats.

3. The Dextrous and Indeterminate parties both won seats from the Sinistrals only.

4. The relative positions of the parties are unchanged.

5. Each party gained and lost either a perfect square or a perfect cube of seats to finish with either a perfect square or perfect cube number of seats.

6. The total number of seats is unchanged and no other party won a seat.

So now you can work out the new state of the parties.”

Can you?


Enigma 663: Clock hop

From New Scientist #1818, 25th April 1992 [link]

I visited my niece Melinda again, and found that she had acquired another new puzzle (where does she get them?). This one is called Clock Hop, and is a kind of peg solitaire. The pegs are arranged in a circle of five holes, with one hole left empty. The pegs are numbered consecutively, from 1 to 4. The puzzle is to rearrange them in the order 4, 3, 2, 1, with the empty hole in the original position, by shifting pegs — but one is only allowed to shift a peg as many spaces as its number indicates (and, of course, there has to be an empty hole waiting to receive it!). Pegs can move in either direction around the circle — clockwise of counterclockwise. With so few pegs, it seems like a very easy puzzle.

What is the minimum number of moves required to solve my niece’s Clock Hop puzzle?


Puzzle #170: Presents, but not correct

From New Scientist #3389, 4th June 2022 [link] [link]

“Have you written your thank-you letters, Kayleigh?”

“Not yet mum, just doing it now. Do I thank Amelia for the nail varnish, Beth for the book, Clara for the lip balm, Diaz for the pencils and Elinor for the sunglasses?”

“At least four of those are wrong.”

“Ah, then was it Amelia for the book, Beth for the lip balm, Clara for the pencils, Diaz for the nail varnish and Elinor for the sunglasses?”

“That’s better, but you’ve still made mistakes.”

“How about Amelia for the lip balm, Beth for the sunglasses, Clara for the pencils, Diaz for the book and Elinor for the nail varnish?”

“Even better, but still not full marks. Clara didn’t give you the pencils or the sunglasses!”

“I give up.”

Can you help?


Tantalizer 321: Paper-chains

From New Scientist #872, 15th November 1973 [link]

Arthur Amble, the town clerk of Footle, has just put his signature to the final minute in a file dealing with Environmental Recycling (Re-use of Paperclips). The file has many fascinating features, not least the fact that each of Footie’s 12 senior officers has now signed it twice.

The town hall has a rigid chain of command. Amble presides with the help of his deputy (Bumble) and Bumble’s deputy (Crumble). Crumble has three deputies, the Planning Officer (Dimwit), the Engineer (Eggwit), and the Treasurer (Frogwit). These last three are of equal and independent status and each has his own deputy (Gumling, Halfling, and Inkling respectively). These too are of equal and independent status and they share a deputy between them, who rejoices in the name of Junket. Junket’s deputy is Krumpet, and Krumpet’s is Limpet. Limpet is this the deputy-deputy-deputy-deputy-deputy-deputy-deputy-town clerk, which sounds better in German; he has no deputy.

It is a strict rule at Footle that memoranda and minutes may be passed only between officer and immediate deputy. Thus Dimwit, for instance, can deal only with Crumble and Gumling – not even with Eggwit or Frogwit. Each minute must be signed.

Given that Eggwit signed the paperclip file before Halfling and that Frogwit signed it before Gumling, can you list the 24 signatures in order?


Enigma 861: Tomorrow and tomorrow

From New Scientist #2016, 10th February 1996 [link]

Tom, Dick, Harry, Anne and Belinda are on holiday together on the island of Alvbe (Ars Longa Vita Brevis Est), where it is the custom to celebrate diversaries (rather than anniversaries) of everything – and particularly of one’s birth.

Today Tom is celebrating a palindromic diversary of his birth. “Happy prime diversary”, says Anne. “And tomorrow you’ll be twice a prime,” says Dick. “And the day after tomorrow you’ll be three times a prime,” says Belinda. “And the day after that you’ll be four times a prime,” says Harry.

So, how old is Tom today (in, of course, days – the number of days since his birth)?


Puzzle #169: A domino piazza

From New Scientist #3388, 28th May 2022 [link] [link]

Some town squares are designed as giant chessboards, but urban planner Dominica has paved her town’s new piazza with giant dominoes instead.

Picking different dominoes at random from a set, she laid them down flat to form a 7×7 square of numbers (pictured, below), leaving one space in the centre for a fountain.

Using the numbers on the diagram, can you draw the outlines of the dominoes that Dominica used, and figure out which dominoes she left out?

(Remember that a full set of dominoes contains every pair of numbers from 0-0 to 6-6. There were no duplicates).


Enigma 661: The last smoke

From New Scientist #1816, 11th April 1992 [link]

The great dictator Fidelio T. Castersugar was forced to flee his banana republic after a counter-counter-coup and take up residence on a deserted island with his chauffeur Miguel. Now there was nothing for Miguel to drive, but that did not mean there was not plenty for him to do. While Fidelio planned his counter-counter-counter-coup, Miguel made fires, gathered coconuts, swept the beach and did the laundry. His main task was to make a temporary humidor for the cigars Fidelio had brought with him.

On the first day Fidelio let Miguel smoke one cigar and then smoked a thousandth of the number remaining. On the second day he gave Miguel two cigars and then smoked a thousandth of the number remaining. On the third day he gave Miguel three cigars before smoking a thousandth of the number remaining. He carries on like this, each day letting Miguel smoke one more cigar than he had on the day before, before smoking a thousandth of the number of cigars remaining, until, one fine day, there are no more cigars left.

Given that neither Fidelio, nor indeed Miguel, would even dream of smoking a fractional cigar, or relighting a cigar which has gone out or (horror of horrors!) making a new cigar from stale cigar butts:

How many cigars had Fidelio smoked up? How many had Miguel smoked up?


Tantalizer 320: Devil’s dice

From New Scientist #871, 8th November 1973 [link]

One perpetual novelty, at least a century old but always good for a fresh marketing under a new name, is the set of four coloured cubes best known as devils dice. If you opened them up and laid them flat, they would look like the diagram, A, B, C and D being the four colours.

According to legend, the devil, always a sportsman, once offered them to a dying sinner as a last chance to save his soul. If the poor lad could stack them in a column each of whose four sides showed four different colours, Old Nick would stay his hand. If, within the obvious time limit, not, then not.

Perhaps you would like to try. Please do not complain at having a diagram instead of the real thing. The diagram makes it easier, at any rate for those wanting to reason it out. It should take about 15 minutes, if you start by asking what each die consists of for purposes of the puzzle.


There are now 2700 puzzles available between the Enigmatic Code and S2T2 sites. If you have been playing along and have solved them all, Congratulations!

In total there are 1586 Enigma puzzles available, with 208 puzzles remaining to post. So, about 88.4% of all Enigma puzzles are now available.


Enigma 862: Distances

From New Scientist #2017, 17th February 1996 [link] [link]

The mileage chart shows the distances between various secret government establishments, each of which is designated by a three-digit code. The distance between two locations can be calculated by adding the differences between the three pairs of corresponding digits, ignoring the signs of the differences. Thus the distance between 689 and 773 is (7 − 6) + (8 − 7) + (9 − 3) = 8.

For reasons of security the government wants these locations to be as far apart as possible, and is concerned that two of them are only four miles apart. Locations 000 and 999 must be retained, but the other four can be moved to locations represented by any three-digit codes, to make the closest pair as far apart as possible.

What is the greatest possible distance between the closest pair?


Puzzle #168: Bone idle

From New Scientist #3387, 21st May 2022 [link] [link]

University student Rick Sloth has spent his life avoiding work, and even though it is exam season he has no intention of mending his lazy ways.

He is studying palaeontology, which he thought might be an easy option when he signed up for it, as he loves dinosaurs, but he has now discovered that it requires rather more study than he was expecting.

It turns out there are 18 topics in the syllabus and his end-of-year exam will feature 11 essay questions, each on a different topic. Fortunately for Rick, candidates are only required to answer four questions in total.

Rick wants to keep his exam preparation to a bare minimum, while still giving himself a chance of getting full marks.

How many topics does he need to revise if he is to be certain that he will have at least four questions that he can tackle?

And can you come up with a general formula for the minimum number of topics you need to study based on the number of exam questions and topics in the syllabus?


Enigma 660: Bookworm

From New Scientist #1815, 4th April 1992 [link]

I have ten volumes of Applications of Abstract Algebra together in order on my shelves. Each volume has 100 pages and the page numbering continues through the volumes from 1 to 1000.

A bookworm started to nibble through the even-numbered side of a leaf (whose number was a perfect square): it kept nibbling in a straight line — through covers as well — and when it stopped it had just emerged through a leaf onto its odd-numbered side (whose number was also a perfect square). Ignoring the covers, it had eaten through a number of leaves which was also a perfect square.

What were those three squares?


%d bloggers like this: