Enigmatic Code

Programming Enigma Puzzles

Tag Archives: by: Christophe Maslanka

Enigma 446: Pocket money

From New Scientist #1597, 28th January 1988 [link]

The benefactor Lord Elpis was superstitious to a degree which surpassed mere triskaidekaphobia, shunning black cats and saluting magpies. Indeed, his superstition was more a form of sympathetic magic. He kept two watches, Tick and Tock. When Tick ran down he would wind Tock, so that Tick could rest and vice versa.

One of his many peculiarities related to money, which he only ever carried in his trouser pockets. His trousers had two pockets and two pockets only, and in these he would carry only those non-zero sums of money which could be split between the two pockets in such a way that the amount in his left pocket multiplied by the amount in his right pocket was exactly equal to the amount in the left and right pockets taken together.

Thus, for example, he could carry £6.25, as it was possible to put £5 of this in his left pocket and the remaining £1.25 in his right, since the product of these sums is equal to the sum of these sums.

Given that 100 pence equals £1 and that the penny is the smallest unit of currency:

(a) How many different sums can Lord Elpis carry?
(b) What is the most he can carry at any one time?



Enigma 438: Doubloons

From New Scientist #1588, 26th November 1987 [link]

Our gallant ship had been overrun by pirates just off Tortuga and their leader, the notorious Black Jake, was strutting about our decks among his jeering men tormenting the captives.

Black Jake swaggered through the smoke in my general direction. “They tell me you have a head for figures, landlubber,” he sneered, prodding me with a gnarled forefinger.

“Er yes,” I said, in what must have been one of my less distinguished utterances.

“Then solve this or walk the plank. In this purse I have doubloons and doubloons only; their number consists of four digits. If you double the number of doubloons and reverse the digits of the number so formed you obtain the same number of doubloons as there would be in the purse were you to add two doubloons to their number.”

By this time my head was swimming. But I knew that if I didn’t solve it on the double that worry would become a drop in the ocean.

How many doubloons were there in Black Jake’s purse?


Enigma 433: Double vision

From New Scientist #1583, 22nd October 1987 [link]

Professor Didipotamus had been working on the equation:


in which each letter stood for a single digit and B was a multiple of E.

“Oh dear,” he said, “that has too many solutions. For example: 76 = 493. Or, worse still, if A were 9, we could have 94 = 812 or 96 = 813.”

So saying, he scratched his head and put on his bifocals. To his surprise, the equation on his whiteboard now seemed to read:


“Now that’s the sort of equation I like,” he remarked to a flowering cactus. “It should have only one solution.”

Given that A, B, C, D and E all stand for different digits, that B is a multiple of E, and E is not 1, what number does ABCDE represent?


Enigma 429: Professor Quark

From New Scientist #1579, 24th September 1987 [link]

Professor Quark was standing in a queue at a cheese counter. “I seem to be in a rather stationary state,” he mused out loud. “This queue and my position in it have a special property. You see,” he explained to an imaginary observer, “if one person were to drop out of the queue ahead of me, the number obtained by dividing the number behind me by the number remaining ahead would be an integer or half an integer. If instead a person were to drop out of the queue behind me, then number obtained by dividing the number ahead of me by the number remaining in the queue behind me would also be either and integer of half an integer.”

Bearing in mind that a queue with, say, 3 in front and 4 behind is distinguishable from one with 3 behind and 4 in front, and assuming Quark’s calculations were correct:

(a) How many distinguishable queues satisfy Quark’s observation?

(b) What was the largest number of people, including Quark, that there could have been in the queue?


Enigma 425: Them thar’ Hills

From New Scientist #1575, 27th August 1987 [link]

“I am old,” said Mr Methuselah, “but not as old as the Hills. Did you know that if you add up the ages of all the Hills exceptin’ Mr Hill you gets his age? And did you know that if you multiply the ages of all the Hills except Mr Hill you get a number which contains ones only, and as many ones as there are Hills, not counting Mr Hill? Every Hill has a different age less than 100, and every Hill’s age in years is odd, exceptin’, of course, Mr Hill.”

I didn’t know this. How could I? I had only just arrived in Rome, Georgia, the knew nothing of the locality. But once he had told me it sure set me to wondering:

How old is Mr Hill? How old is Mrs Hill? And how old are the Hillocks?


Enigma 420: A princely sum

From New Scientist #1570, 23rd July 1987 [link]

The King of Zoz was asked by his son for 88,200 ducats to cover the latter’s gambling debts incurred at college.

“That is indeed a princely sum!” said the King, calling for his ornate coffer, the one containing single ducats only.

“How much is there in the old coffer of yours?” asked the Prince as two servants struggled with it it.

The father smiled indulgently but knowingly and replied: “If you were to multiply the number of ducats it now contains by the number of ducats would remain in it were I to remove 88,200 ducats, you would arrive at a perfect square.”

“There must be many numbers of ducats which fit those constraints,” said the son wistfully.

“Aye. And if you have the wit to deduce the number of different numbers of ducats there could be in the coffer consistent with my statement I shall know that you have learnt something and I shall pay your debt. If not, you can cover it yourself.”

Assuming there will be at least one ducat remaining in the coffer if the King removed 88,200 ducats, how many different possible numbers of ducats are there?


Enigma 416: Short notice

From New Scientist #1566, 25th June 1987 [link]

I am making a noticeboard from a sheet of cork. In my search for some wood to back it, I came across two pieces having the same area as the cork, but different dimensions. To make the first piece fit, it would have been necessary to cut A feet off the cork and B feet off the wood, and to fit the second would have required C feet to be cut off the cork and D feet off the wood.

When I arrived at the timber yard I had forgotten the dimensions of my piece of cork. I remember only that, in measuring A, B, C and D, I obtained 1 foot, 2 feet and 4 feet only, with one measurement occurring twice. Which one occurred twice and in what order I obtained these measurements I forget.

All I can remember is that the cork measured a whole number of inches along each side and that none of its sides measured a whole number of feet.

Can you help me to deduce the size of wood I need to buy before the woodyard closes?

(Answers in inches, please: 1 foot = 12 inches).


Enigma 412: A triangular square

From New Scientist #1562, 28th May 1987 [link]

Enigma 412

Professor Kugelbaum, deep in thought and in a distracted state, wandered onto a building site. He saw a man laying equilateral triangular slabs on a plain flat area. Turning his keen mind from the abstract to the concrete, he asked the man with a sudden inspiration, “What are you doing?”

“I’m laying a town square.”

“But the angles aren’t right.”

“Well, it’s going to be a square in the form of an enormous equilateral triangle”, was the reply.

“I don’t call nine slabs enormous.”

“Ah”, said the workman, “first, I haven’t finished yet: I’ve just started at one apex. Secondly, if you look carefully, you’ll see that there are in fact 13 different triangles to be found in the pattern I’ve already laid [see diagram]. When I’ve finished there will be 6000 times as many more triangles to be found in the completed array.”

Kugelbaum’s mind began to tick over.

How many slabs will there be in the completed array?

This puzzle brings the total number of Enigma puzzles on the site to 1,100 (and by a curious co-incidence on Monday I posted Enigma 1100 to the site). This means there are (only!) 692 Enigma puzzles remaining to post, mostly from the 1990s. There is a full archive of puzzles from the inception of Enigma in February 1979 up to May 1987 (this puzzle), and also from September 2000 up to the end of Enigma in December 2013. Happy puzzling!


Enigma 407: Bug-in-a-box

From New Scientist #1557, 23rd April 1987 [link]

A collector was ordering a thin rectangular box to house insects captured in the field.

“Each of its edges must measure a whole number of inches”, he told the carpenter.

“Well, that leaves a lot of room for manoeuvre”, the other remarked.

“That’s exactly the point”, the collector said. “You see, they cling to the edges of the box for security, poor little mites, and they detest traversing the same edge twice … But though they are confined to the edges they can still dream of unconquerable space. In fact I don’t know which is more important, the volume or the length of the edges. You’d better make the volume in cubic inches equal to the sum of all the 12 edges of the box”.

“Well, that narrows is down a little”, said the carpenter.

“Oh dear, I hope not”, said the collector. “Please make it as big as you can consistent with these specifications”. So saying he rushed out, almost snagging his net on the door handle.

The carpenter produced the box just as he was bidden. Assuming bugs do refuse to traverse any part of an edge previously trodden by them, what is the furthest a captive bug can walk before it becomes bored?


Enigma 403: Taking stock

From New Scientist #1553, 26th March 1987 [link]

“What animals have you in that barn there?” said the man from the ministry.

The farmer beamed. “Pigs, cows and ducks, sir.”

“How many are there, though?”

“Oh, quite a few, really, sir.”

“I need figures, man!” persevered the would-be census taker.

“If it’s figures you’ll be wanting, sir,” replied the farmer, “I can tell you that multiplying the number of horns by the number of legs by the number of wings gives 720.”

“Yes, but how many of each animal are there?” snapped the other exasperatedly.

“Telling you the number of cows alone wouldn’t enable you to deduce the number of ducks and pigs. Telling you the number of ducks alone wouldn’t enable you to deduce the number of pigs and cows. But telling you the number of pigs would enable you to deduce the number of cows and ducks right enough. So I reckon you can work out how many cows and ducks there be in yonder barn even if I don’t tell you the number of pigs in it.”

With that he ducked into a hen-house.

How many cows, ducks and pigs were there in the barn?


Enigma 400: Potential difficulties

From New Scientist #1550, 5th March 1987 [link]

I asked Electrophorus what he was working on.

“You know that joining unlike terminals of a pair of batteries produces a voltage across the two free terminals equal to the sum of the voltages of the separate batteries. And connecting unlike terminals produces a voltage equal to the difference of the voltages of the separate batteries?”

“Yes”, I replied. “With a battery of 2 volts and one of 5 volts one obtains 3 volts (sources opposing) or 7 volts (sources reinforcing).”

“Well, before lunch I had three batteries, none of which had zero voltage, and a voltmeter with a holder that would accommodate only two batteries. So I measured the voltages across the free terminals of all possible pairwise combination of these three batteries both in the case where the voltages reinforced and where they opposed. I wrote on my blackboard the resulting six positive numbers in order of increasing magnitude.”

“When I returned from lunch eager to calculate the ratings of the three batteries, I found the three batteries gone and my blackboard wiped clean. I remember that the second smallest reading occurred twice. It was either 13 or 17 volts, I forget which. I had noticed, rather inconsequentially perhaps, that reversing the digits of this double reading produced another reading which occurred in my measurements.”

What were the ratings of the three batteries?


Enigma 394: Unwinding

From New Scientist #1544, 22nd January 1987 [link]

Professor Kugelbaum was unwinding at the Maths Club with a cigar after lunch when a wild-looking man burst in and introduced himself thus:

“My name is TED MARGIN. Juggling with the letters of my name one obtains both GREAT MIND and GRAND TIME. But I digress. Each letter of my name stands for one digit exactly from 1 to 9 inclusive and vice versa. And, do you know,

(A × R × M) / (A + R + M) = 2,

MAD is greater than ART (though RAT is greater than either), and TED = MAR + GIN.

If, in addition, I were to tell you the digit which corresponds to M then you could deduce the one-to-one correspondence between the letters of my name and the digits 1 to 9″.

At this point a helpful butler removed the man, but Kugelbaum was amused to find that the information was quite consistent.

Write the digits 1 to 9 in the alphabetical order of the letters to which they correspond.


Enigma 391b: Christmas recounted

From New Scientist #1540, 25th December 1986 [link]

Delivering Christmas presents is not an easy task and Exe-on-Wye has grown to be so populous that it is hardly surprising that this year Santa Claus decided to delegate the delivery to his minions. Thanks to some failure in communication, however, instead of each house receiving one sack of presents, each of his helpers left a sack at each and every house. The number of sacks that should have been delivered happens to be the number obtained by striking out the first digit of the number of sacks delivered.

When Santa Claus discovered this, he was not pleased. “Things couldn’t be worse!” he groaned. “The number of sacks you should have delivered is the largest number not ending in zero to which the addition of a single digit at the beginning produces a multiple of that number”. And he disciplined the unhappy helpers.

But for each unhappy helper there were many happy households in Exe-on-Wye on Christmas morning.

Can you say how many unhappy helpers and how many happy households?

This puzzle completes the archive of Enigma puzzles from 1986, and brings the total number of Enigma puzzles on the site to 1,058. There is a complete archive from the start of Enigma in February 1979 to the end of 1986, as well as a complete archive from February 2001 to the end of Enigma in December 2013, which is 59% of all Enigma puzzles, and leaves 733 Enigma puzzles left to publish.

I have also started to post the Tantalizer and Puzzle problems that were precursors to the Enigma puzzles in New Scientist, and so far I have posted 16 of each. In total there are 90 Puzzles (which I can get from Google Books) and 500 Tantalizer puzzles (of which the final 320 are available in Google Books).

Happy puzzling (and coding)!

[enigma391b] [enigma391]

Enigma 387: Tea for two

From New Scientist #1536, 27th November 1986 [link]

The Emperor decided to reward two philosophers, who, despite their widely different lifestyles, had never disagreed in the whole of their careers. Their reward was explained to them as follows:

“You, Ti-Fu-Tu, poet and hedonist, drink jasmine tea, while you, Tu-Fu-Ti, old warrior and ascetic that you are, drink only gunpowder tea. In my storehouse are vast numbers of identical cubical boxes of both teas. You may take as many boxes as you will as long as you stack them thus:

The stack must form a singular rectangular parallelepiped consisting of equal numbers of boxes of jasmine and gunpowder. The surface of the stack on all its six sides must be a single layer of boxes of jasmine. Within this single layer must be a rectangular parallelepiped of gunpowder tea. Of course, the boxes must be stacked face-to-face with no gaps.

“A stack of 960 boxes, measuring 8 by 10 by 12 should answer,” reasoned Tu-Fu-Ti. “Stripping off the outer layer would reveal a stack measuring 6 by 8 by 10 containing 480 boxes of beloved gunpowder.”

“Tchah!” snapped Ti-Fu-Tu. “I’m sure we can do better than that!”

Can you tell them (before they squabble and forfeit their reward) the number of boxes they would each have if they produce the largest stack obeying the above conditions?


Enigma 382: Dice

From New Scientist #1531, 23rd October 1986 [link]

While rummaging through the library stacks I found a Latin manuscript which translates roughly as follows:

Dear Uncle,

The natives in these desert parts use tetrahedral dice, rather than the cubical ones of Rome; a tetrahedral die sticks into the sand point first, which is useful when there are no pavements to play on. Each face on a given die is numbered with a different natural number (being nomads they count zero as a natural number). A set consists of two dice numbered in such a way that no score with a single die or with a set is a power of two, apart from the highest score possible with a pair. (In case you are rusty, Uncle, 1 is counted as a power of 2). What’s more, you can’t throw a total of zero with a set. Every other score up to the highest can be thrown with a pair.

I won’t bore you with an account of my losses, but I am told that the information given is sufficient to determine the numbers on each of the two dice.



What numbers are inscribed on the two dice?


Enigma 378: A sleeper awakes

From New Scientist #1527, 25th September 1986 [link]

I fell asleep during a lecture and dreamed that I was out in the country. In my dream I saw a field and in this field some four-legged cows being milked by at least one two-legged milkmaid who had the use of a number of three-legged stools. There were more stools than would suffice for one per milkmaid, and more cows than would suffice for one per milking stool.

Given this information, and the number of legs in the collection, I realised that one could work out unambiguously the number of cows, stools and milkmaids in the field. Furthermore, the number of legs in the field was the largest it could have been, consistent with these facts.

I awoke with quite a start when the lecturer addressed a question to me. Unfortunately, the answer I gave to his question was the number of cows, milking stools and milkmaids that I had dreamed of. Of course, everyone laughed, but I bet they wouldn’t be able to solve that in their sleep!

How many milkmaids were there in my dream, and how many milking stools and cows?


Enigma 374: Just the ticket

From New Scientist #1523, 28th August 1986 [link]

Mr Bagel was intrigued when approached by Mr Bola selling raffle tickets, for he had never taken part in a raffle.

“I see that each ticket in your book has the same number of digits on it, the first having a number of zeros followed by a one, and the number on each successive ticket increasing by one.”

“That’s true,” replied Bola. “I haven’t sold any yet. Perhaps that’s because there is to be only one winning ticket.”

“Now tell me, Tom,” asked Bagel, “what happens if a ticket number is composed entirely of invertible digits, namely 0, 1, 8, 6 or 9, so that is also forms a number when viewed upside down?”

“In a draw we always read the tickets out with the perforation on the left,” replied Bola.

“That’s a pity, otherwise one could buy two numbers for the price of one ticket.”

Bagel, being superstitious, chose a ticket with an invertible number. One way up the number was divisible by all the even digits, and the other way up it was divisible by all the odd digits. Moreover, when his ticket number was multiplied by a digit (I forget which), the product was the number of the last ticket in the book, a number in which none of the digits was invertible.

I forget whether he won the draw, or even what the draw was for. But, given the chances of his winning were better than one in 100,000, what was the number on the last ticket in the book?


Enigma 369: A safe number

From New Scientist #1518, 24th July 1986 [link]

“My memory is poor, but accurate,” said Mooncalf. “I remember just enough of the characteristics of my safe combination to enable me to reconstruct the number when I forget it. It contains a pair of 1s separated by one digit, a pair of 2s separated by two digits, a pair of 3s separated by three digits and so on, there being twice as many digits in the number as the value of the highest digit. Yet I can’t even remember the highest pair of digits.”

“There must be many such numbers,” I opined, reaching for my notepad. “For example, 312132. That has two 1s separated by one digit, two 2s separated by two digits and two 3s separated by three digits.”

“Yes. But what makes my safe number unique is that it is the highest number that can be formed in this way. As an aide-mémoire, I have written part of it on a card. If anyone stumbles across it he is unlikely to tumble to its true significance. First I write the safe number backwards. Then, starting from the right I discard from this number, one by one, as many digits as I can, consistent with there occurring at least once in the number which remains each digit of the original number. This final number is my aide-mémoire.”

“You mean if it were 41312432 you would be left with 23421 on the card?”

“Exactly. But I have locked it away in the safe, and I want you to help me to deduce my combination so I can open the safe and retrieve it.”

Scratching my head, I got down to work. In no time at all I had deduced the number and had retrieved Mooncalf’s card.

What was the number inscribed on it?


Enigma 365: Men of letters

From New Scientist #1514, 26th June 1986 [link]

Six Professors, A, B, C, D, E and F, are the guest speakers at a philosophy conference at St Gadarene’s. So that they should not be confused with the audience they are given labels A, B, C, D, E and F by the organisers. Unfortunately, none of them ended up with the right label. On the way up to the podium, Professor A asks the man wearing the letter B: “Are you Professor C?”

“No. Why do you ask? You’re not wearing C. But Professor C ought to swap labels with Professor F, for then one of them would have the right label. And in case you were wondering, I’m not D either.”

“I’ve never seen such disarray. It would be quite impossible to choose a single pair from the six of us in such a way that one of the two might truthfully say to the other: ‘We two have each other’s labels’.”

“Well, it could be worse. At least the company can be divided into two groups, each of which would sport the same letters as the professors it contains. What’s more, each group would have a label with a vowel on it. Now please leave me alone, I’m a solipsist.”

By this time the applause had died down and it was decided that the professors should present their papers in the alphabetical order of the labels they each wore.

I wasn’t too happy with the paper about utilitarianism. I enjoyed “Why pragmatism doesn’t work”. But most of all I enjoyed deducing the names of the professors from their labels.

Can you list the names of the six professors in the order in which they presented their papers?


Enigma 360: For the time boing

From New Scientist #1509, 22nd May 1986 [link]

“This is my favourite clock,” said Mr Fescu, the Curator of the House of Clocks. “It has a curious mechanism which prevents it from stopping or being started except exactly on the hour. It only chimes on the hour and normally emits a number of bongs equal to the hour it is striking. But if it stops and is restarted at a later hour less than 12 hours on it emits all the chimes it missed between the stopping and starting times, not counting those of the hour at which it is restarted.”

“You mean if it stops at 9:00 and is restarted at 8:00 it emits 70 bongs?”

“Precisely,” said my guide, clutching and enormous key. “And what is more interesting is that certain numbers of bongs are special, in that they occur between one unique pair of stopping and starting times only. If you heard 70 bongs it could only signify that the clock stopped at 9:00 and was restarted at 8:00. Given the time at which the clock has stopped this time, there is only one hour at which I could rewind it to yield a magic number of bongs, and Lo!” he said, hopping from foot to foot and gesticulating at the church clock just visible in the distance, “that hour is arrived.”

So saying he moved the hands to the right time, wound the mechanism up and kicked it, whereupon it emitted an uneven number of bongs and a prime number at that.

What was the time; when had the clock stopped; how many bongs did the clock emit?