# Enigmatic Code

Programming Enigma Puzzles

## Puzzle #179: Martian food

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?

[puzzle#179]

## Puzzle #177: Monkeying around

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?

[puzzle#177]

## Puzzle #168: Bone idle

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?

[puzzle#168]

## Puzzle #164: Sum thing wrong

Amira presented her homework to her teacher:

“I promise you it is right. It is just that I have used a code. Every digit used represents a different digit, and the same digit is always represented by the same ‘wrong’ digit. For example, maybe I replaced all the 6s with 4s. Or maybe I did something else…”

“You are giving me a headache, Amira.”

What is the correct sum?

[puzzle#164]

## Puzzle #158: League of nations

The TV sporting highlight of my childhood was always the Five Nations rugby championship, which involved a series of matches between England, Scotland, Wales, Ireland and France.

Every fortnight, on Saturday afternoon, there would be two matches, with the fifth country having the day off.

The fixture list had an elegant symmetry to it. Each country played every other country once, with two matches at home and two away, and each country alternated between playing at home and away.

I recall that in one year, the fixtures on the opening Saturday were Ireland vs England and France vs Wales, and that, on the third Saturday on which matches were played, Wales competed at home.

If those memories are correct, what were the final two matches of the competition?

[puzzle#158]

## Puzzle #155: Mother Hubbard

Ada Hubbard loves creating riddles and takes every opportunity to pose them. She occasionally includes her daughter Betty in her brain-teasers.

“I am five times as old as Betty was when I was as old as Betty is now. When Betty is as old as I am now, then I will be 77”

How old are Ada and Betty?

[puzzle#155]

## Puzzle #154: Party line-up

“So, Maureen, how electable are they?” asked Tariq, the local party chairperson, counting up the number of people on the list of possible candidates for the by-election.

“It’s good news and bad news. The good news is that I have looked into their backgrounds and discovered that eight of them have proven leadership skills, seven of them have been completely honest about their expenses, and six of them are always loyal to the party when they tweet.”

“Good. And because I know how many candidates there are, I can be certain that at least one of them must have all three of these virtuous traits! What’s the bad news?”

“Um, well you are right, but unfortunately there is only one candidate who has all three virtues – and it is your nemesis Judy Prim.”

How many candidates are there in total?

[puzzle#154]

Tom Tightwad keeps his money in a safe, the code for which is a 10-digit number that uses every digit between 0 and 9.

Fearful of forgetting the code, Tom wrote it on the front of the safe, but disguised it. He wrote the first five digits along the top of a 5×5 grid, and the last five digits down the side. Then he multiplied each digit along the top by each digit down the side, filling the grid with 25 numbers. Finally, he erased his code number from the top and side so that only the grid remained.

Unfortunately, the clumsy fellow also erased most of the numbers in the grid. And of what remains, some digits are so hard to read that they have been replaced with an “X” (for example, in the diagram, the code’s first digit multiplied by its eighth digit is now “20-something”).

Can you crack the safe?

[puzzle#153]

## Puzzle #151: Alien fingers

When the aliens landed in my back garden, my first thought was that they use the same number system as we do, because there was a two-digit number written in our Earthly digits on the side of their spaceship.

But when the aliens emerged from the ship, I saw that they each had 16 fingers. I intuited that they therefore used a hexadecimal (base 16) method of counting. Their first ten digits, from 0 to 9, work just like our terrestrial decimal system, but 10-15 are expressed as A to F, respectively. After F (our 15) comes 10 (our 16), 11 (our 17) and so on. What can I say, I am very intuitive.

In hexadecimal, 1E is the same as our decimal 30 (one 16 and fourteen 1s) and their 25 is our 37 (two 16s and five 1s).

The number painted on the side of their ship was therefore written in hexadecimal. Yet by a remarkable coincidence, it could be translated into our number system by simply reversing the order of the digits.

What was the alien number in Earthly notation?

[puzzle#151]

## Puzzle #150: A jigsaw puzzle

Logan pulled an old jigsaw box off the shelf and gazed at the picture of a carousel on the lid. Under the picture in big, bold type it stated “468 pieces”.

He tipped out the contents. It didn’t look like 468 pieces. He started to count, but realised it would take a long time. What if he just counted the edge and corner pieces? That might be quicker, and if any of those pieces were missing, that would confirm that it wasn’t a complete jigsaw.

If only Logan knew how many edge pieces there were, including corners. Since there was nothing unusual about the shape of the jigsaw, how many should he expect to find?

[puzzle#150]

## Puzzle #146: Meg’s pegs

Meg and Greg are playing a guessing game. Meg picks a code of four coloured pegs, each of which may be red, yellow, green or blue.

Greg’s first, incorrect guess at Meg’s code is red-red-blue-green.

Meg tells Greg how many pegs are the correct colour in the correct place. She then tells him how many of the remaining pegs are a correct colour in the wrong place.

“Interesting!” laughs Greg. “In that case, I know your code.”

What is Meg’s code?

This is one of 4 puzzles published in the same issue of New Scientist.

[puzzle#146]

## Puzzle #145: Up the sprout

My local greengrocer has a strange way of weighing produce. Vegetables go in a pan attached to a string that goes around a frictionless pulley and the pulley hangs from a suspended spring scale. The other end of the string is secured to the floor.

I picked out some sprouts for my Christmas dinner, at the bargain price of £1 per kilogram. The weighing scale indicated 1.6kg.

How much do the sprouts weigh? And how much do I owe?

This is one of 4 puzzles published in the same issue of New Scientist.

[puzzle#145]

There is an old adage that one person’s “creativity” is another person’s “cheating”. This week’s puzzle will test which side of the fence you sit on.

The numbers 1 to 9 have been written on cards and left on a table: the left-hand column adds up to 21 and the right one to 24. Move just one card so that the two columns add up to the same total. There’s a classic “Aha!” solution to this puzzle, but my daughter came up with a solution I wasn’t expecting. Since then, I have been offered at least 10 more distinct solutions.

How many solutions can you find that you regard as “creative” rather than “cheating”?

[puzzle#121]

## Puzzle #116: More Soccerdoku

Our football league archivist has another challenge on his hands (see Puzzle #104, 13th March 2021). A second old newspaper report has surfaced, this time from the 1991 season. The table shows how things stood at the end of the season after all teams had played each other once. There were three points for a win and one for a draw, as you might expect, with Albion winning the league and Rovers bottom. How annoying that so much of the table got smudged.

Can you use your forensic skills to figure out all the match scores for that season?

(* denotes an entry that has been smudged beyond recognition).

[puzzle#116]

## Puzzle #104: Soccerdoku

“Football league tables are a bit like accounts”, says Harry the bookkeeper. “The debits and credits must balance. For example, victory for one team means defeat for another, so the total games won must be the same as the total games lost. And every goal scored for one team is a goal against another one.”

Harry’s insights will help our league’s archivist. The newspaper cutting with the results of the 1993 season is now smudged, and several entries are illegible. The teams played each other once, and this is how the season ended:

Can you fill in the blanks and work out the scores in all the matches?

[puzzle#104]

## Puzzle #100: Late for the gate

This deceptively tricky everyday problem set in an airport was first posed by the US mathematician Terence Tao in 2008.

You are in a bit of a rush to catch your plane, which is leaving from a remote gate in the terminal. Some stretches of the terminal have moving walkways, or travelators, and others are carpeted. You always walk at the same speed, but travelators obviously boost this.

You look down and spot that your shoelaces have come undone. This won’t slow you down, but it is annoying, so you decide to stop to tie them. It will take the same amount of time to tie you laces if you are on the carpet or on the travelator, but if you want to minimise the time it takes you to reach the gate, where should you tie your laces?

What if you are feeling energetic and can double your walking speed for 5 second? Is it more efficient to run while on a travelator, or on the carpet?

[puzzle#100]

## Puzzle #96: Inside the box

Can you join the 36 dots below using 10 straight lines, with your pen never leaving the paper and no lines going outside the grid? At least one line must pass through each dot and no devious rule-bending is required. You will find lots of ways to do it with 11 lines, but 10 is much more of a challenge.

P.S. This puzzle forces you inside the box, but its solution is related to the classic four-line, nine-dot problem that was the origin of the cliché “thinking outside the box”.

[puzzle#95]

## Puzzle #95: Catch Up

Catch Up 5 is a two-player game using five stacks of toy bricks of height 1, 2, 3, 4 and 5. The aim is to end with a taller tower than your opponent. Player A starts by taking a single stack of any height – in the example above, they chose the “2” stack. B then takes as many stacks as they want, piling them up until their tower is the same height or taller than A’s, which ends B’s turn. Here, B took the “1” stack, then the “5”. A now does the same, stacking until their tower is at least as tall as B’s. Here, A took the “3” stack, then the “4”. The players take turns until all the stacks of bricks have been used up, so A won this game.

Imagine you are going first in game against a Catch Up 5 expert who always plays the optimal move when it is their turn. Which piece should you choose?

[puzzle#95]

## Puzzle #94: Fastest fingers first

The contestants were lined up, each hoping to get into the Millionaire chair. First, they would need to get through the “fastest fingers first” round.

The host cleared his throat: “List these animals in order of the number of legs they have, starting with the most:”

A: Fettlepod
B: Eldrobe
C: Sentonium
D: Quizzlehatch

Guessing blindly, Jasmine went for CDBA, Virat chose CBDA and Finnbarr picked ADCB, but none got all four right. In fact, they all got the same number of answers in the correct position.

Which has more legs, a Fettlepod or a Sentonium?

[puzzle#94]