Enigmatic Code

Programming Enigma Puzzles

Tantalizer 13: Balls

From New Scientist #563, 21st September 1967 [link]

Take a red, a blue and a green bucket. Ask a friend to put into them three red, three blue and three green balls in such a way that:

1. There are three balls in each bucket.
2. There is a blue ball in each bucket.
3. There are no green balls in the green bucket.

Now point to a bucket (without looking inside it) and have him throw you one ball from it at random. Repeat the process until you have collected one red, one blue and one green ball.

What is the smallest number of balls collected in this way which cannot fail to include the selection required?

A variation of this puzzle appears in the book Tantalizers (1970) under the title “Billiard Balls”.

[tantalizer13]

Enigma 838: Time for insomniacs

When I went to bed last night I glanced at my digital bedside clock just before dozing off. When I stirred briefly between one and two hours later, I glanced at the clock again and confirmed that I had been asleep for that long. And then I had another sleep and when I stirred again, an exact number of hours after first dozing off, I again confirmed this on the clock.

When I can’t sleep I often ponder on the numbers displayed on the clock (like noting at bedtime one evening that the 1056 on the clock, as illustrated above, was the product of my age and my house number). On those three occasions when I looked at the clock last night, one of the numbers which I saw was palindromic, another was a perfect square and the other consisted of consecutive digits in increasing order.

In fact what I’ve just told you in the previous paragraph is rather misleading: it isn’t true about the three actual times because on the middle occasion I was very drowsy and I didn’t look at the clock but at its reflection in the bedside table top. I didn’t realise my mistake immediately because the number I saw did seem like a reasonable time.

At what time did I first doze off?

[enigma838]

I collect Russian dolls, the type where each doll can be opened to reveal a smaller one inside. I am particularly fond of my simple, single-coloured ones, which come in sets of five (and, unusually, have a hollow smallest doll). I have five lovely sets of them, each a different colour.

Alas, while I was out, my daughter Kira rearranged them so that each large doll now contains one each of the four other colours. She proudly tells me that no blue doll contains a doll that has a yellow doll anywhere within it. There is no doll that contains a pink doll with a red doll anywhere within it. And no yellow doll contains a green doll with a pink doll anywhere within it.

“By the way, have you seen my wedding ring?” I ask her.

“Ah, I put that inside the smallest blue doll” replies Kira.

Which coloured doll should l open first if I want to find the ring as quickly as possible?

Tantalizer 12: Aunts

From New Scientist #562, 14th September 1967 [link]

“Be a dear”, said Aunt Agatha, “and write to that nice man about the things”.

“The man who collects beetles about the hymn-books”, replied my aunt without hesitation. “Here’s his address:

Ernest Baggins,
Mallards,
Appleton,
Kent”.

“That doesn’t sound right, dear”, interrupted Aunt Maud. “I’m sure he’s not Baggins. Where’s my book? Yes, here we are:

Ernest Boggins,
Halyards,
Surrey”.

“That’s not what I’ve got”, put in Aunt Jobiska. “I’ve got:

Edward Biggins,
Haystacks,
Cuxham,
Surrey”.

“Not Biggins, Jobiska, Boggins”, this from Aunt Kate.

“Edward Boggins,
Pollards,
Appleton,
Sussex”.

“Stuff!”, said Aunt Tabitha rudely, “He is called Ernest Buggins, poor man, and his address is:

Willows,
Surrey”.

As no Aunt was willing to give way, I had to ring the vicar and he, it turned out, was both deaf and loquacious. However, I got the name and address in the end and found that each aunt had been right in exactly two out of her five particulars.

What is his name and address?

A version of this puzzle appears in the book Tantalizers (1970) under the title “Aunt Maud”.

[tantalizer12]

Enigma 937: Progressive football

From New Scientist #2092, 26th July 1997 [link]

The teams in the Midshires league play each other once during their season, which runs from mid-September to March. They each play up to three times a week, getting three points for a win and one point for a draw.

At the end of the past season, the teams’ total points were calculated and the teams were placed in decreasing order. The top team had one more point that the second which had one more point than the third, which had one more point than the fourth and so on until the penultimate team, which had one more point than the bottom team.

More than a third of the teams played in no draws at all, more than a third of the teams played in one draw, a quarter of the teams played in two draws, and the rest played in more than two.

How many teams are there in the league?

[enigma937]

Headscratcher #223: Setting the right tone

“Not one of your best, is it?”, smirked Michael, peering over Leo’s shoulder at the portrait he was painting. “The colours are so drab. Who is she?”

“The name’s Lisa”, said the model, smiling enigmatically from the other side of the easel.

“I’m trying to mix a glaze to perfect the tone of her face”, sighed Leo. “But I seem to have run out of paint”.

“Yes, about that”, said Michael. “I might have borrowed some for a ceiling. In any case, it looks like you’ve got two brownish dollops there”.

“One of them is equal parts yellow, red and blue. The other is five parts yellow, three parts red and four parts blue. But anyone can see her cheeks require 10 parts yellow, eight parts red and nine parts blue!” said Leo.

Lisa sat and listened quietly, with a knowing look in her eye. Or maybe sad, or bored; it is hard to say. But if Leo is to finish his portrait, in what proportions should the two dollops be mixed to produce the right tone?

This puzzle sees the name of the series switch from Puzzle to Headscratcher. Probably related to the book Headscratchers due to be published in October 2023 [link].

Tantalizer 11: Night-watchman

From New Scientist #561, 7th September 1967 [link]

Old Charlie is night-watchman at the Kite Company. His parish consists of 12 buildings and a gatehouse. laid out thus:

His orders are to inspect all 12 buildings during the night. He is to inspect each building the same number of times, beginning with No 1, keeping to the paths shown and ending up finally at the gatehouse. Having inspected a building, he must inspect at least one other (or the gatehouse, which he may inspect as often as he likes) before inspecting that building again. Each stretch of path is 100 yards long, except 1-6 and 1-11, which are 200 yards.

Old Charlie has a conscience and rheumatism so he carries out his orders faithfully but walks not one yard further than he need.

How far must he walk in the night?

This puzzle appears in the book Tantalizers (1970).

[tantalizer11]

Enigma 837: The quick brown …

We arrange the 26 letters of the alphabet in a row as follows:

THEQUICKBROWNFXJMPDVLAZYGS (*)

Now take any letter, say P, and find the longest chains in (*) in alphabetical order ending with P. We find some of length 5, for example EIKMP, but none any longer. Next we find the longest chains in (*) in reverse alphabetical order starting with P. We find some of length 3, for example PLG, but none any longer. We say P has alphabetical length, α=5, and reverse alphabetical length, ω=3.

Question 1: I have chosen a letter which comes before P in the alphabet and to the left of P in (*). Can you say for certain my letter has α less than 5?

Question 2: I have arranged the 26 letters in a new row (**). Can you say for certain that if you choose a letter in (**) and I choose a different letter in (**) then they will have different α’s or different ω’s?

Now I want you to write on a piece of paper, a list of 25 possibilities for α and ω so [α=1 ω=1], [α=1 ω=2], …, [α=1 ω=5], [α=2 ω=1], …, [α=2 ω=5], [α=3 ω=1], …, [α=5 ω=5].

Next I want you to take each letter in (*) and work out α and ω for it and mark it on the list, for example you will write P against [α=5 ω=3]. Unfortunately, some letters will have a combination of α and ω that is not on the list, for instance X has α=6 and ω=4.

Question 3: Can you arrange the 26 letters of the alphabet in a row so that every letter has a combination of α and ω that is in the list? If your answer is “yes” then give such a row.

Question 4: Can you be certain that you will be able to find in my row (**) a chain of 6 letters that are in either alphabetical or reverse alphabetical order?

[enigma837]

Puzzle #222: A question of balance

Being sentimental, Patty likes to use her grandmother’s beam scales when weighing out ingredients to make a birthday cake for her own granddaughter. The only problem is that the scales aren’t accurate as the two arms are of slightly different lengths.

To overcome this, she uses both pans and measures half the required quantity in each. For example, to weigh 2 kilograms of flour, she will put a 1-kilogram weight in the right-hand pan and weigh the flour on the left-hand pan, then place the weight in the left-hand pan and weigh a second batch of flour on the right-hand pan. The combined portions of flour will, she thinks, weigh exactly 2 kilograms.

Is she right or will she have more or less than 2 kilograms?

[puzzle#222]

Tantalizer 10: The case of the mangled millionaire

From New Scientist #560, 31st August 1967 [link]

“An inelegant crime”, observed Holmes, surveying the wrecked library. The mangled body of Sir Plutus Gnome sprawled on the rug and beside it lay the hammer and sickle which had produced its present unpleasing condition. Pocketing his magnifying glass, Holmes turned to the five police inspectors.

“Well, gentlemen, what does the evidence tell us of the culprit?”

The first inspector cleared his throat: “We are looking”, he said, “for an unmarried right-handed woman who is shorter than the deceased.”

“No”, said the second, “for an ambidextrous married communist the same height as the deceased.”

“No”, declared the third, “for a married man who is an anti-communist and taller than the deceased.”

“No”, put in the fourth, “for an unmarried, left-handed, female communist.”

“I disagree”, remarked the fifth, “we want a right-handed man, taller than the deceased, who has no feelings about communism either for or against.”

Holmes gave them a glance both penetrating and scornful. “You have done very well, gentlemen” he pronounced. “Each of you is right in exactly two particulars. Now, it is clear that there are only four possible suspects; George Crabtree, the victim’s bachelor nephew, Miss Pringle, his secretary, Henry Hetherington, his accountant, or Henry’s wife, Mary. You will no doubt be able to determine which of the four perpetrated the deed.”

Who mangled the millionaire?

This puzzle appears in the book Tantalizers (1970) under the title “The Mangled Millionaire”.

[tantalizer10]

Enigma 836: Who buys the drinks?

A group of friends were in the Rose and Crown, debating who should pay for the round. By chance they were seated round the table in the sequence Alan, Brian, Charlie, David … with alphabetically consecutive first initials up to Mr Smith’s.

They took part of a pack of cards, shuffled it, and placed it face down on the table. They agreed to draw one card each, Alan, then Brian, and so on round and round the table, until someone drew a black card. That man would buy the drinks. If they had studied the cards first, they would have discovered that they had more than half the pack and that they had equal chances of drawing the first black.

In the event, the drawing process lasted as long as it possibly could with that selection of cards. What was the initial of the man who bought the drinks?

[enigma836]

Puzzle #221: Logical World Cup

“Drat”, said Ron the reporter. “Now the Logical World Cup is over, the editor wants to know how many games each team won, drew and lost, but all I have are the points totals”.

“Maybe I can help”, said Martha the mathematician. “Show me what you’ve got”.

Ron passed her the sheet of paper he had been glaring at:

“Hm. I presume it was a round robin with three points for a win and one for a draw?”

“But of course”, said Ron.

“Then I can tell you the other columns” said Martha.

Can you?

[puzzle#221]

Tantalizer 9: Digweed

From New Scientist #559, 24th August 1967 [link]

Now that our school has introduced the personalised time-table, it is no fun being a housemaster. Take Digweed, for instance.

He has two years to go before A-level and must take exactly three subjects in each year. He is to do Geography for at least one year and English for exactly one year. If he does English in the second he must take French in the second. If he does English in the first, he must take Geography in the first. If he does not do French in the second, he may not do Geography in the first.

If he does not do History in the first, he may not do Geography in the second. If he does not do French in the first, he is to do History in the second. His first year may not include both French and Geography; nor his second both French and History.

Digweed tells me with a smirk on his face that his time-table is impossible. But he has forgotten that I can force him to do Latin, if need be.

What subjects will he be doing in each year?

This puzzle does not appear in the book Tantalizers (1970), but a similar puzzle appeared as Enigma 260.

[tantalizer9]

Enigma 835: Treble top

Whenever I play darts I keep track of my score by writing down how many points I scored for each go (consisting of three darts) followed by the number of that go. For example, if I scored 27, 154 and 84 on my first three visits I would have written 2711542843.

After a recent game I noticed that if the digits were consistently replaced by letters, with different letters for different digits, then it read:

TREBLETOPSATDARTS

My total score was a prime number.

[enigma835]

Puzzle #220: Artificial Intelli-Vision song contest

There was controversy at this year’s Artificial Intelli-Vision song contest, in which each of the competing countries used Al to generate their entries.

Every nation had a judging panel that gave a score to each of the others. The “songwriters” all tried to engineer a higher score for their country by letting an Al generate their ditty as a danceable blend of one other country’s all-time favourite tunes.

This led to a strange outcome. Each judging panel awarded 10 points to the song tailored to its national preferences and the same lower number of points to all of the others. For example, the Transylvania panel gave a perfect 10 to Ruritania’s artificially intelligent effort “Everybody Let’s Dance Last Night Tonight”, while giving only a 7 to all the rest.

The song contest’s board decided to restore artistic integrity to this prestigious event by deducting the inflated 10 from each country’s set of scores. After this, the grand total of all scores was 222, with no two nations tied for any position.

Can you figure out how many countries took part and how many points the winning song scored?

[puzzle#220]

Tantalizer 8: The church afloat

From New Scientist #558, 17th August 1967 [link]

When the old destroyer, Fantastic, was turned into a floating missionary chapel, instead of being scrapped, the following worthies were present at her re-launching:

The Bishops of:

Armuth
Bangor
Cone

Sir Desmond Drake
Sir Evelyn Easy
Sir Francis Fish
Sir Gregory Grogg
Sir Harry Hornpipe.

Afterwards they repaired to the wardroom to drink the toast of “The Church Afloat”. It was no thimble-sized toast and presently the eight dignitaries were arm in arm on the deck and singing lustily. Everyone, I regret to report, was wearing someone else’s hat. This is what the bishops sang, each topped with a cockaded nautical tile:

Armuth:
My hat is on the head of a man,
whose hat is on Sir Desmond.
Bangor:
My hat is on the head of a man,
whose hat is on the head of a man,
whose hat is on Sir Evelyn.
Cone:
My hat is on the head of man,
whose hat is on the head of a man,
whose hat is on the head of a man,
whose hat is on Sir Francis.

Sir Harry Hornpipe, resplendent in episcopal mitre, then opened fire:

Hornpipe:
My hat is on the head of a man,
whose hat is on the head of a man,
whose hat is on the head of a man,
whose hat is on the head of a man,
whose hat I’m proudly wearing.

Luckily it started to rain at this point, before anything worse befell. It thus only remained to restore the hats to their rightful owners.

Who was wearing whose?

A variation on this puzzle appears in the book Tantalizers (1970) under the title “The Sailor’s Puzzle”.

[tantalizer8]

Enigma 834: Square root of seven

This week I have replaced every letter of the alphabet by a digit. Of course, that means that some digits may represent several different letters, but any particular letter is replaced by the same digit throughout.

With my particular use of the digits you will find that each of the following seven:

TWO
THREE
FOUR
FIVE
SIX
SEVEN
EIGHT

is a number and that although one of the three-figure numbers is not a square all the remaining six numbers are perfect squares.

Find the value of ROOTS.

[enigma834]

Puzzle #219: The second red queen

“You know that debt you owe me?”, says Svengali, rather menacingly. “I am prepared to write it off — but only if you have a bit of luck”.

He takes out a regular pack of playing cards and gives them a thorough shuffle. “Now”, he declares, “I am about to turn over all the cards one at a time, but first I want you to predict the position of the second red queen that I will turn over. If your guess is correct, I will write off your debt”.

My odds aren’t high. There are 52 cards in a pack. Only two of them are red queens the queen of hearts and the queen of diamonds. And only one of those will be the second red queen to be turned over.

“I will give you one bit of advice”, says Svengali, noting my pensiveness. “Don’t choose the top card, because by definition that cannot be the second red queen — though it might be the first”.

Which card position in the range 2 to 52 should I nominate for the second red queen? Or should I just pick a random number?

[puzzle#219]

Tantalizer 7b: Three men in a boat

From New Scientist #557, 10th August 1967 [link]

When George, Harris and I go on the river, we take it in turns to row, steer and cook. With George rowing and Harris steering the boat goes slower than with Harris rowing and me steering but faster than with me rowing and George steering.

We have found that the boat’s speed is a simple sum of a rowing element (in knots) and a steering element (in knots) and that each of us makes a measurable contribution at the oars or the helm. George is the best helm or the worst oar or both.

Each of us is the best of us in one department — I mean rowing, steering or cooking — and the worst in another.

Which of us is the best cook?

Both this puzzle and the one published the previous week were Tantalizer 7.

This puzzle appears in the book Tantalizers (1970).

[tantalizer7b] [tantalizer7]

Enigma 833: Equal shares

Anna and Wesley each have seven book tokens and each token is for a whole number of pounds. The total value of Anna’s tokens is no more than £126 and the total of Wesley’s is no more than £127.

Anna sat down at the table and worked through all the possible combinations of her seven tokens, finding the total value for each combination. She did this by first taking each token by itself, then each pair of tokens, then each combination of three tokens and so on. She was looking for two combinations which had the same total. Wesley did the same thing with his tokens.

Anna had two cousins and she wanted to give each of them some tokens so that each received the same total value.

Wesley wanted to the same for his two cousins.

On the basis of the information we have, answer each of the following questions “Yes” or “No”:

(a) can we say for certain that Anna was able to find two combinations which had the same total?

(b) can we say for certain that Wesley was able to find two combinations which had the same total?

(c) Can we say for certain that Anna was able to give some tokens to her two cousins so that they each received the same total value?

(d) Can we say for certain that Wesley was able to give some tokens to his two cousins so that they each received the same total value?

[enigma833]