Enigmatic Code

Programming Enigma Puzzles

Enigma 1044: Seven-digit squares

From New Scientist #2200, 21st August 1999

I have found a 2-digit number that can form (without at any stage reversing the order of the digits) both the first 2 digits and the last 2 digits of both a 5-digit and a 6-digit and a 7-digit perfect square.

Harry and Tom have each found a 2-digit number that can form (without reversing the order of the digits) the first 2 digits of a 5-digit and a 6-digit and a 7-digit perfect square, the last 2 digits of these squares in each case being the same as the first 2 but in reverse order.

Harry’s 3 squares are all palindromes, but Tom’s squares are not all palindromes.

What are the 7-digit squares formed by (1) me, (2) Harry, (3) Tom?


Enigma 465: Alphadividical

From New Scientist #1616, 9th June 1988 [link]

In the following division sum, some of the digits are missing, and some are replaced by letters. The same letter stands for the same digit whenever it appears, and different letters stand for different digits.

Enigma 465

Find the correct sum.


Puzzle 40: The washing machine that didn’t

 From New Scientist #1091, 23rd February 1978 [link]

“A detective is what I am, my dear Sergeant Simple”, as Professor Knowall has so often said to me.

“And detection is what I am interested in, even though the facts and objects to which you call my attention may appear to be only trivial and unimportant pawns in the game of life”.

When the mystery of the washing machine, therefore, was brought to my notice it seemed reasonable to take the professor at his word and put the facts before him.

This machine, I’m afraid, was not the washing machine it had been. Errors, inefficiencies and failure to wash had somehow crept in. I did not feel, however, that I could reveal the terrible things that this machine had been doing and I therefore decided that a screen of anonymity was required.

And so neatly anonymous did I make it that the results looked like this:

1. D, E is followed by q, r;
2. B, C, E is followed by q, s, t;
3. A, C, D is followed by p, t.

I showed this proudly to the professor, but I am afraid that his reaction was disappointing.

“Can’t you ever get things right, Sergeant?”, he said.

It is a humble Simple who has to confess to his public that the professor was once more quite right. There was one mistake in the causes, i.e., in the capital letters, so that to get it right one either has to cross one out or add another one (say, F).

On the assumption that each of the faults are caused by single events and not by two or more in conjunction or separately, what can you say about Sergeant Simple’s mistake and about the causes of the various defects?


Enigma 1045: Prime tournament

From New Scientist #2201, 28th August 1999

Fifteen players entered a tennis tournament in which each player played one match against each of the others.

At the end of the tournament each player added up the number of matches he or she had won. All the totals turned out to be prime numbers. Furthermore, each of the prime numbers less than 15 was the total for a prime number of players.

The tournament gave an unfair bias to the men and it turned out that every man won more than half his matches, whereas no woman won more than half her matches.

How many women entered? And in how many matches did a woman beat a man?


Enigma 464: Up hill and down dale

From New Scientist #1615, 2nd June 1988 [link]

The dashboard of my car has two distance recorders, namely one five-digit display for the total miles travelled since the car was made, and one three-digit display for the distance travelled (ignoring any thousands) since the last time I set to zero. The latter one is for measuring lengths of journeys, but I never use it. It happens that both displays “clock-up” extra miles at the same moment.

When I bought the car secondhand from its original owner the five-digit display consisted of five consecutive digits in increasing order, and the three-digit display consisted of three consecutive digits in increasing order, and the two displays had no digit in common. Even though I have done fewer miles in the car than the original owner I am going to trade it in today. As I asked the garage to quote me a price for it, they asked me to confirm that the total mileage was as shown, which I was able to do. And when I looked I noticed that the five-digit display consisted of five consecutive digits in decreasing order, the three-digit display consisted of three consecutive digits in decreasing order, and that the two displays had no digits in common!

How far had the car travelled since bought it?


Tantalizer 446: Unready reckoners

From New Scientist #997, 22nd April 1976 [link]

Mrs Green and Mrs Brown were conversing about their young in honeyed tones. The topic was prowess at simple arithmetic. Under a mantle of mutually admiring words, they had soon agreed to a duel. The offspring were summoned from the sand pit and set the task of adding seven, three and two.

Little Willie Green wrote done 7 + 3 + 2 = 12 in barely the time it takes to boil an egg. Tommy Brown was still chewing his pencil. Several minutes elapsed before he arrived at SEVEN + THREE + TWO = TWELVE. But Mrs Green’s consoling noises were short lived. Young Tommy, it emerged, had treated the problem as one in cryptarithmetic, with each different letter standing for a different digit.

What was his (correct) numerical rendering of TWELVE?


Enigma 1046: Albion yet again

From New Scientist #2202, 4th September 1999

Albion, Borough, City, Rangers and United have played another tournament. Each team played each of the others once. Two matches took place on five successive Saturdays, each of the five teams having one Saturday without a match.

The points scoring system was: 1 point to each team winning on the first Saturday, 2 points to each team that won on the second Saturday, 3 points to each team that won on the third Saturday, 4 points to each team that won on the fourth Saturday, and 5 points to each team that won on the fifth Saturday. But a draw was an allowable result: if a match was drawn each team was awarded half the points it would have been awarded for winning it.

The final table was: Albion won with 7 points, Borough, City and Rangers all tied with 6 points, and United finished last with 5 points. But if they had used the traditional points scoring system that awards a team 2 points for each win and 1 point for each draw the order of the teams would have been reversed: United would have finished with more points than any other team and Albion would have finished with fewest points, the other three teams still tying for second place.

If Borough beat City on the fourth Saturday give the results of Rangers’ matches, listing them in the order in which they were played and naming the opponents in each match.


Enigma 463: Eights

From New Scientist #1614, 26th May 1988 [link]

It was a lovely day down by the river and I was in the mood for poetry or love. In fact I was just about to knock back another Pimms and look for Euthanasia when through the crowd a puzzling person from Pembroke broke in on my private bliss.

“You know,” he said, skipping the customary formalities, “that any power of 10 above or equal to 1000 can be represented as a sum of strings of 8s? For example, that 1000 = 888 + 88 + 8 + 8 + 8?”

“Yes …” I said, as a big girl in a straw hat trod on my foot. “Or 1000 = 88 + 88 + 88 + 88 + 88 + 88 + 88 + 88 + 88 + 88 + 88 + 8 + 8 + 8 + 8.”

“Yes. But the first example represents the number 1000 with the fewest 8s. And this fewest number of 8s is 8, which is itself a string of 8s, though admittedly a rather short one, consisting of just one 8.”

“What,” he went on, “is the next power of 10 such that the number of 8s used in representing it as the sum of the fewest number of strings of 8 possible, is itself a string of 8s?”

I paused to remove a fly floating in my Pimms.

“In mathematical language, then, you are saying: find the first integral value of n greater than 3, such that when you express the number 10n as the sum of the fewest number of numbers consisting of the digit 8 only, this fewest number of 8s used is itself a number consisting of the digit 8 only.”

“Precisely,” he grinned, as some chap rolled down into the water nearby and Lady Fanshaw burst out into horrible tinkling laughter somewhere near my left ear, “all in base 10, of course.”

What is the value of n?


Teaser 2503

From The Sunday Times, 12th September 2010 [link]

George has placed two vertical mirrors touching each other, with an angle between them. He has also placed a small cube between the mirrors and counted how many images there are of it in the mirrors. (For example, if the mirrors had 90 degrees between them, there would be three images). He wrote down two whole numbers – the angle between the mirrors, in degrees, and the number of images of the cube. When Martha saw the two numbers, she commented that their product, appropriately, was a perfect cube.

What was the angle between the mirrors?

Note: After much discussion of this puzzle, regular solvers of The Sunday Times Teaser puzzles have decided that the puzzle is flawed, and there is not enough information given to arrive at a unique solution. Nevertheless the puzzle has some interesting aspects to it.


Enigma 1047: Friday the 13th

From New Scientist #2203, 11th September 1999

Someone has told George that the 13th of a month is more likely to be a Friday than any other day of the week, but he is not sure whether he should believe it.

This year, 1999, the date Friday the 13th occurs only once, in August. Last year, 1998, it occurred three times, in February, March and November. It is clearly somewhat irregular.

If George choose a random month in a random year on the Gregorian calendar, what is the probability that it will include Friday the 13th? Please give your answer as a fraction in its lowest terms.


Enigma 462: The cricket mystery

From New Scientist #1613, 19th May 1988 [link]

Our local cricket club consists of 11 married couples with surnames, Ashes, Bowler, Cricket, Declare, Eleven, Fielder, Googly, Hit, Innings, Join-at-the-wicket, and Kit. Recently there have been complaints that cricket balls have been hit out of the ground into local gardens. It was known that, in each couple, only one partner is capable of hitting the ball out of the ground.

On the last practice evening, 11 balls were hit out of the ground. From my position I could only tell, each time, that the hitter was one of a group of players, for example, the first ball hit out was hit by Mr Declare or Mrs Eleven or Mrs Hit. The full list was as follows:

1. Mr D, Mrs E, Mrs H;
2. Mrs B, Mrs F, Mrs J, Mr K;
3. Mrs A, Mr F, Mr G, Mr I;
4. Mrs F, Mrs K;
5. Mrs A, Mr C, Mr G;
6. Mrs A, Mr D, Mrs E, Mr F, Mrs G, Mr H;
7. Mrs B, Mrs F, Mr J, Mr K;
8. Mr A, Mr D, Mr F;
9. Mrs C, Mr F, Mrs I;
10. Mr B, Mrs F, Mr K;
11. Mr E, Mr F, Mrs G.

Who could I definitely say had hit a ball out of the ground?


Puzzle 41: Division

 From New Scientist #1092, 2nd March 1978 [link]

In the following division sum each letter stands for a different digit.

Rewrite the sum with the letters replaced by digits.


Enigma 1048: Rows and columns

From New Scientist #2204, 18th September 1999

A square field has its sides running north-south and east-west. The field is divided into an 8 × 8 array of plots. Some of the plots contain cauliflower. A line of plots running west to east is called a row and line of plots running north to south is called a column.

John selects a row and walks along it from west to east, writing down the content of each plot as he passes it; he writes E to denote an empty plot and C to denote a plot containing cauliflower; he writes down EECECCEC. He repeats this for the other seven rows and writes down ECEECCCE, ECECEECC, ECCECCEE, CEECEECC, CECECECE, CECCECEE and CCECEEEC. The order in which John visits the rows is not necessarily the order in which they occur in the field.

Similarly, Mark selects a column and walks along it from north to south, writing down the content of each plot as he passes it; he writes down EECECCCE. He repeats this for the other seven columns and writes down EECCEECC, ECECECEC, ECCECEEC, CEECCECE, CECECECE, CCEEECEC and CCECECEE. The order in which Mark visits the columns is not necessarily the order in which the occur in the field.

Draw a map of the field, showing which plots contain a cauliflower.

Enigma 1248 was also called “Rows and columns”.

There are now 1200 Enigma puzzles on the site (although there is the odd repeated puzzle, and at least one puzzle published was impossible and a revised version was published as a later Enigma, but the easiest way to count the puzzles is by the number of posts in the “enigma” category).

There is a full archive of Enigma puzzles from Enigma 1 (February 1979) to Enigma 461 (May 1988), and of the more recent puzzles from Enigma 1048 (September 1999) up to the final Enigma puzzle, Enigma 1780 (December 2013). Which means there are around 591 Enigma puzzles to go.

Also on the site there are currently 53 puzzles from the Tantalizer series, and 50 from the Puzzle series, that were published in New Scientist before the Enigma series started.

Happy Puzzling!


Enigma 461: Additional letters, literally

From New Scientist #1612, 12th May 1988 [link]

Below is an addition sum with letters substituted for digits. The same letter stands for the same digit whenever it appears, and different letters stand for different digits:

Enigma 461

Write the sum out with numbers substituted for letters.


Tantalizer 447: Marching order

From New Scientist #998, 29th April 1976 [link]

Brother Ambrose, in cell A, desires to visit the chapel, M, for compline. But he belongs to a stern and silent order, which keeps movement and contact to a minimum. No monk may ever enter an occupied room or halt in a corridor. Only one monk may be in movement at any time. Luckily the order is a bit below strength at present and there are only Ambrose, Bernard, Crispin, Ethelbert, Francis, Hadrian, Imogius, Keith and Leo, each in the cell of their letter.

Call it one move when a monk moves from one room to another (possibly passing through other unoccupied rooms). In how few moves can Ambrose get to the chapel, and each other monk return to his own cell?


Enigma 1049: Know-all

From New Scientist #2205, 25th September 1999

I told Alan and Bert that I had two different whole numbers in mind, each bigger than 1 but less than 15. I told Alan the product of the two numbers and I told Bert the sum of the two numbers. I explained to both of them what I had done.

Now both these friends are very clever. In fact Bert, who is a bit of a know-all, announced that it was impossible for either of them to work out the two numbers. On hearing that, Alan then worked out what the two numbers were!

What was the sum of the two numbers?


Enigma 460: Tear me off a strip

From New Scientist #1611, 5th May 1988 [link]

I had a rectangular block of stamps four stamps wide. I tore off one stamp. Then I tore off two stamps. Then I tore off three stamps, and so on, and so on. Each time, the stamps which I tore off formed a rectangle of their own, in one piece. And, following this pattern, the last piece I required (which needed no tearing off because it exhausted my supply of stamps) was also a rectangle. And only when I was forced to was any of these rectangles a strip one stamp wide. (So, for example, the four stamps and the subsequent non-primes were not in thin strips).

Each time, after tearing off the stamps, the remaining stamps were in one piece and formed either a rectangle or an L-shaped piece.

How many stamps did I start with?


Puzzle 42: Football – four teams

 From New Scientist #1093, 9th March 1978 [link]

Four football teams are to play each other once. After some of the matches had been played a table was drawn up giving some details of the matches played, won, lost, etc. But unfortunately Uncle Bungle had been at it again and the digits (from 0 to 9) had been replaced by letters. Each letter stood for the same digit wherever it appears and different letters stood for different digits.

The table looked like this:

(Two points are given for a win, and one point to each side in a drawn match).

Find the score in each match.


Enigma 1050: Find the link

From New Scientist #2206, 2nd October 1999

I was trying to construct a chain of 2-digit and 3-digit perfect squares such that each square in the chain had at least two digits in common with each of its neighbours (or with its sole neighbour, if it was at either end of the chain). If a square had a repeated digit that digit only counted more than once in calculating the number of digits that the square had in common with another square if it also appeared more than once in the other square; so 121 had only one digit in common with 100, but 100 had two [digits] in common with 400.

I found that I could construct three totally different chains each consisting of at least five squares; and I made each of these chains as long as possible, consistent with the stipulation that no square should be used more than once. But I could not link these chains into a single long chain until I used one particular 4-digit square as the means of linking one end of my first chain to one end of my second chain and also the other end of my second chain to one end of my third chain. In each place where it was used, this 4-digit square had at least two digits in common with each of its chain neighbours.

(1) Identify this 4-digit square.
(2) Which were the squares at opposite ends of the single long chain?


Enigma 459: Stepped triangles

From New Scientist #1610, 28th April 1988 [link]

Enigma 459

Yehudi Everknott instructed a builder to make a patio in the form of a stepped triangle in the middle of his perfectly flat back lawn. The patio was to be made from a number of rectangular plane slabs, each having the same dimensions and alignment. The sides of each slab were to measure a whole and exact number of feet and were to be joined edge to edge with no gaps or overlap, to produce a stepped triangle whose two smaller sides were to be straight lines and whose hypotenuse was to be in steps of one slab. As if that were not enough, the perimeter in feet was to equal its area in square feet.

At first the builder, a Mr Zolyakar, who charged £11 per square foot, thought in terms of square slabs and produced an estimate based on the greatest number of square slabs that would fit Everknott’s conditions. Then he produced another estimate for the largest stepped triangle meeting Everknott’s conditions and using rectangular slabs. Again he charged £11 per square foot.

(a) For how much was his first estimate?
(b) For how much was the second?