Enigmatic Code

Programming Enigma Puzzles

Enigma 673: Sliding blocks

From New Scientist #1828, 4th July 1992 [link]

There are 15 small square blocks placed in a tray. Each block has a letter on it and they are placed as in the diagram:

Because of the empty space in the bottom corner, it is possible to slide the blocks about within the tray’s boundary to get other arrangements, for example:

Which of the following arrangements is it possible to obtain by sliding the blocks about?


Enigma 670: Round in circles

From New Scientist #1825, 13th June 1992 [link]

Look at any arrangement of the digits 1 to 9 equally spaced around a circle. For example:

In this example, reading both ways around the circle, pairs of adjacent digits make the following two-figure numbers:

56, 68, 81, 19, 93, 32, 24, 47, 75, 74, 42, 23, 39, 91, 86, 65, 57

just three of which are prime. If I reverse the position of, say, the 3 and the 7 in the circle, then I get an arrangement which produces five primes.

Your job today is to find an arrangement of the digits 1 to 9 around a circle so that the 18 two-figure numbers read around the circle in both directions do not include any primes and such that there are two different digits whose sum is 10 with the property that if you interchange those two digits then the new arrangement still produces no primes.

What are those two interchangeable digits?


Puzzle #179: Martian food

From New Scientist #3398, 6th August 2022 [link] [link]

It is the year 2100 and the Mars pioneers have built an agri-bubble in which they will be able to cultivate their own food. The crop is a form of grass that grows at a steady rate and can be harvested and turned into nutritious protein snacks (yum!). Now it is time to populate the planet.

Scientists have figured out that if there are 40 adults living in the bubble, the crop will only feed them for 20 days. However, with only 20 adults, the crop will keep them going for 60 days — so half as many adults can survive for three times as long! Why? Because without overharvesting, the crop is able to replenish itself.

Of course, the pioneers want a food supply that keeps the population sustained indefinitely. Based on the numbers above, how many people should be in the first Mars cohort?


Enigma 672: Amazing odds

From New Scientist #1827, 27th June 1992 [link]

My niece Melinda likes to solve mazes, so I gave her a problem involving an odd maze of numbers:

I told her that from any odd number n greater than one, she could move to another odd number as follows: take an odd divisor of n – 1 and multiply it by an odd divisor of n + 1. From 11, for example, she could move to 5 × 3 = 15, because 5 divides 10 and 3 divides 12. 1 is allowed as a divisor, so she could also move to 1 × 3 = 3, 5 × 1 = 5, or to 1 × 1 = 1. 1 is a dead end, of course, and certain numbers, like 31, inexorably lead to 1. I asked Melinda to find the shortest path from 13 to 19 and back to 13 again (without falling into the Black Hole at 1!).

Can you help Melinda? Find a path from 13 to 19 and back again in the least number of steps.


Enigma 854: Colourful Christmas

From New Scientist #2009, 23rd December 1995 [link] [link]

As Christmas approaches and the winter weather takes hold, so two nuns bring food and clothing to the refugee camp that has been established near to their hospital. There are 27 huts in the refugee camp, ranged in a circle and numbered 1, 2, 3, …, 26, 27 as we go round the circle, with 27 also being next to 1. In order to brighten the camp up for Christmas, each hut has a coloured flag in front of it, red or blue or yellow. The rule for the camp is that if two huts are next to each other in the circle then their flags must be of different colours. Each morning the flags are put out as follows:


That is to say, 1=R, 2=B, 3=Y, …, 27=Y.

The children in the camp have a supply of flags of all three colours. They choose a hut and go and change its flag, ensuring that they keep the camp rule. They then choose another hut and go and change its flag, still keeping the camp rule. They carry on in this way, choosing one hut after another.

It was late on Christmas Eve when the nuns completed their task and set off for the hospital. When they looked back at the refugee camp they saw it was bathed in moonlight shining through a gap in the clouds, while the surrounding area was in darkness. The younger nun remarked on the contrast and the older agreed and continued, “but it does help us see where our priorities lie”.

On various days the children try to achieve certain patterns of flags. Which of the following are they able to produce?


I have made every effort to transcribe this puzzle correctly. (I believe it is incorrect on the New Scientist web site). To make it easier to read I have added spaces in the sequences of colours, so they are in groups of three.


Puzzle #178: Hydra

From New Scientist #3397, 30th July 2022 [link] [link]

A story:

A hero enters a cave. Inside is a monster with three numbered heads. It attacks! Our hero chops off a head, but two more heads grow in its place. One of the new heads attacks and the hero greets it with a quick chop, too. Standing back, he realises that every chop produces at least one prime-numbered head that, when multiplied by the number on the other new head, gives the number from the head that was chopped. He also notices that all the prime-numbered heads are friendly.

The story’s illustrator squints at the author’s scribbled notes. She can make out the numbers on two of the original three heads (418 and 651) but not the third. Reading ahead, she notices that when the hero collapses triumphant at the feet of the now fully friendly monster, all the heads show different numbers and their sum is 113.

“Aha!”, she declares, and draws the original monster with its three snarling, numbered heads.

What was the third number?


Enigma 671: An average age

From New Scientist #1826, 20th June 1992 [link]

What is the big fuss over age? Some people prefer not to disclose their age, while others attempt the futile task of claiming the same age every year.

I suspect the honesty of the average person falls somewhere between, as show in the addition below. In this addition, different letters stand for different digits, but the same letter stands for the same digit whenever it appears. And Y is twice R.

Find the value of AGES.


Enigma 850: Swapping the letters

From New Scientist #2005, 25th November 1995 [link]

I have 26 boxes numbered 1 to 26 and 26 cards labelled A to Z. I start with A in box 1, B in box 2 … Z in box 26 and I want to end with A in box 2, B in box 3 … Y in box 26, Z in box 1.

I am allowed to make a series of swaps, where a swap consists of choosing any two boxes and swapping over the two cards in them.

So, can I achieve my aim with a series of:

(1) 27 swaps;
(2) 26 swaps;
(3) 25 swaps;
(4) 23 swaps?


Puzzle #177: Monkeying around

From New Scientist #3396, 23rd July 2022 [link] [link]

Scientists have been studying two rare monkey species in a forest.

In one part of the forest live the Equalis monkeys, which are split 50-50 between males and females. In another part of the forest are the Fraternis monkeys, of which exactly two-thirds are male — the evolutionary aspect of this isn’t yet known.

Both species are monogamous, with families coming in all shapes and sizes. Some parents stop at one offspring, but there are others with 10 or more, so some monkeys have lots of brothers, while others have none at all. The sex of any infant is independent of others in the family.

Among Equalis monkeys, which should expect to have more brothers, the males or the females? And how about the Fraternis monkeys?


Enigma 856: Royal birthdays

From New Scientist #2011, 6th January 1996 [link] [link]

There are 12 males in the Utopian Royal family: King Nosmo and his sons, grandsons and greatgrandsons, the Princes Airey, Barry, Carey, Derek, Eric, Fred, Gary, Harry, Igor, John and Kevin. They all have truly palindromic birthdates, that is, not only do the figures read the same each way but there is also no need to rearrange the dashes, so that 15/6/51 would be truly palindromic while 1/5/51 would not. They were all born in different years and have different zodiacal signs.


(1) Although Kevin was just over eleven months old on King Nosmo’s 80th birthday, he has still not reached his first birthday.

(2) Airey, Nosmo’s eldest son, was born in the month of his 18th birthday.

(3) Barry is a year and 10 days older than Carey; Derek is a year and 10 days older than Eric; Gary is a year and 10 days older than Harry; and Igor is a year and 10 days older than John.

(4) Igor was born in June.

(5) Neither Barry nor Gary is an Arien.

Who is the Taurean?


Enigma 669: Stairway to the stars

From New Scientist #1824, 6th June 1992 [link]

A stairway consists of a number of steps and each step contains two of the digits 0, 1, 2, …, 9, for example you might have:

If you have a step [AB] then the step that goes on that step is [CD] so:

where C = the units digit of A × B, and D = the units digit of B + C.

So if we want to add a step on top of [85] above we find 8 × 5 = 40, so C = 0, and 5 + 0 = 5, so D = 5, so we put [05] onto [85].

What is the largest number of steps that you can have in a stairway without repeating a step?


Puzzle #176: Ant-i-clockwise

From New Scientist #3395, 16th July 2022 [link] [link]

When the giant town-hall clock chimed 2 o’clock, an ant resting by the number 2 woke from its nap. Spotting that the minute hand was edging towards it, the ant started walking clockwise round the rim of the clock face. Thinking it had escaped the minute hand, it was shocked when it caught up with the hand again. At that point, the ant turned round and walked anticlockwise back round the rim, at the same constant speed as before, reaching the minute hand for a second time after a further 15 minutes. At this point, it decided to give up and take another nap.

At what time did the ant stop walking?


Enigma 668: A great escape

From New Scientist #1823, 30th May 1992 [link]

When Pembish first moved into Pembish Hall he found the grounds littered with cannon balls, so he ordered his elderly retainer, Punnish, to collect them all and stack them into a single triangular pyramid. Each layer of such a pyramid consists of an equilateral triangle of balls having one ball fewer along its edge than the layer immediately below it, except for the very bottom layer, of course. So the top “layer” contains just one ball, the one below it 3 balls, the one below that 6, the one below that 10 and so on.

Punnish counted the balls and found that it was possible to construct such a pyramid. In fact, he was just putting the last, crowning, ball in place when, to his horror, he heard the monotonous tones of the Reverend Neverend from over the hedge: “Can you tell me the time?” Now Punnish had once slept through the first 17 hours of one of the cleric’s impromptu sermons and he didn’t want to have to hear again the story of how the Reverend had once escaped the Boers disguised as an (extremely boring) chicken.

It was imperative to distract him and so to cut a (very) long story short, Punnish called out: “No, I can’t. But I can tell you the number of cannonballs in this triangular pyramid is the 6-digit number CANCAN, in which each letter stands for a digit. And even if I can’t can cans, I can cancan!”. So saying, Punnish cancanned into the conservatory. The boring cleric thought at first it could be 179 layers, but that would require 971970 balls. So that wasn’t quite right.

How many balls are there in the pyramid?


Enigma 648: Piles of fun

From New Scientist #1803, 11th January 1992 [link]

You will need a box of matches. Divide the matches into a number of piles, not necessarily the same number of matches in each pile. For example, you might lay out:

7, 5, 4, 7, 6, 19, 3.

You are allowed to pick any of two piles. If the piles are equal, put them together to make one pile; if the piles are not equal, take from the larger the number of matches that are in the smaller and add them to the smaller.

Using the example above, if you select the 5 and 3, you get:

7, 2, 4, 7, 6, 19, 6.

If you then select the two piles of 6 you get:

7, 2, 4, 7, 12, 19.

If you then select the second 7 and the 19, you get:

7, 2, 4, 14, 12, 12.

You carry on in this way, repeatedly acting on the piles you got from your previous action. Your target is to collect all the matches into one large pile. Sometimes that is possible, sometimes it is not.

For which of the following layouts is it possible to collect all the matches into one pile?

A: 17, 4, 5, 5, 1, 2, 3, 15, 12.
B: 17, 4, 5, 5, 9.
C: 51, 72, 57, 78, 78, 48.
D: 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 23.


There are now 1600 Enigma puzzles available on the site. And there are 192 puzzles remaining to post. Which means about 89.3% of all Enigma puzzles are now available.

And between Enigmatic Code and S2T2 there are now 2750 puzzles available.


Puzzle #175: Wizard of odds

From New Scientist #3394, 9th July 2022 [link] [link]

The students at Yellow Brick High School for Girls couldn’t decide if their maths and drama teacher, Ms Gale, was a genius or just overworked when she announced the new school play, a “mathemusical” called The Wizard of Odds. But the real challenge, as usual, was in the casting, and the parents, students and faculty had various demands, summed up as follows:

1. If Megan doesn’t get the lead role, Dorothree, then Kasey will play either the Square Crow or the Ten Man.

2. If neither Leah nor Nicki are the Cowardly Line, Jane will will be Dorothree.

3. If Leah doesn’t get the Square Crow, Jane or Kasey will get Dorothree.

4. If Nicki isn’t the Ten Man and if Leah doesn’t get Dorothree, then Kasey will play the Wicked Witch of the Word Problems.

5. If Leah isn’t the Cowardly Line and if Nicki isn’t the Wicked Witch of the Word Problems, then Jane will be cast as the Square Crow.

Remembering that “if x, then y” doesn’t imply “if not x, then not y“, can you help Ms Gale accommodate this tornado of requests by assigning the roles?


Enigma 667: Why worry?

From New Scientist #1822, 23rd May 1992 [link]

In the multiplication below, the digits have been replaced by letters and asterisks. The same letter stands for the same digit wherever it appears, while the asterisks, of course, can be any digit:

The only zero in the multiplication is denoted by an asterisk and I can tell you that it is not in the second partial product (fourth line down). But why worry, you will find it soon enough.

What is WORRY?


Enigma 855: Magic moment

From New Scientist #2009, 23rd December 1995 [link] [link]

We hope to have a few magic moments this Christmas. I’m giving my parents an unusual calendar. Three rulers (of the same thickness, depth and material) slide through a frame.

The 6-inch ruler has marks for Saturday-Friday at one-inch intervals, the 11-inch ruler has marks for January-December at one-inch intervals, and the 15-inch ruler has marks for 1-31 at half-inch intervals. Each day the details of the date are lined up in the frame. The illustration shows how the calendar should have looked on Tuesday 14 March.

The calendar should be anchored to the wall by two central nails in the frame. If the upper nail alone were used the calendar could swing and hang at some peculiar angles.

In fact it would only have hung horizontally on one day in 1995. Which day?


Puzzle #174: Pieces of eight

From New Scientist #3393, 2nd July 2022 [link] [link]

I have a 12-hour digital number display alarm clock. As is normal on digital clocks, each of its four digits is constructed using seven possible segments.

I go to bed when the display is at its dimmest and awake when it is at its brightest.

How long am I in bed?


Enigma 666: Enigmatic 666

From New Scientist #1821, 16th May 1992 [link]

An “absolute difference triangle” is a triangle of numbers such that each number below the top row os equal to the absolute value of the difference of the two numbers above it. For example:


In the following one, letters have been substituted for digits in the top row, with different letters being consistently used throughout for different digits. Stars may have any value:


If I own up and tell you that OWN is a perfect cube and ONE (as you might expect) is a perfect square, then what is ENIGMATIC?


Enigma 665: Occupational hazard

From New Scientist #1820, 9th May 1992 [link]

Alan, Brian and Charles have surnames Adams, Brown and Collins (not necessarily respectively) and occupations of architect, builder and carpenter (again not necessarily respectively). Each of them is either thoroughly honest or thoroughly dishonest. Below are some statements (not necessarily by more than one person) which involve these three people’s names and jobs: (each blank space originally contained one of the surnames — Mr Adams deleted the names after seeing the first few statements):

Alan says:

(i) I am not the architect.
(ii) Brian is a carpenter.
(iii) Charles’s surname is [……….].

Mr Adams says:

(i) The architect’s surname is not Brown.
(ii) The builder’s surname is [………].
(iii) The two spaces contain the same surname.

The architect says:

(i) The builder isn’t called Charles.
(ii) It’s now possible to work out all our names and jobs.

Please state (in order) the [deleted] surnames.

If I’ve counted correctly there are now “only” 200 Enigma puzzles remaining to post. (Actually I think there are 196).


%d bloggers like this: