Enigmatic Code

Programming Enigma Puzzles

Enigma 1101: Disappearing numbers

From New Scientist #2257, 23rd September 2000

This game starts when I give a row of numbers; some numbers in italic [red] and some in bold [green]. Your task is to make a series of changes to the row, with the aim of reducing it to a single number or to nothing at all. In each change you make, you select two numbers that are adjacent in the row and are of different font [colour], that is to say one is italic [red] and the other is bold [green]. If the numbers are equal, you delete them both from the row; otherwise you replace them by their difference in the font [colour] of the larger number.

For example, suppose I gave you the row:

3, 4, 3, 2, 5, 2.

One possibility is for you to go:

[I have indicated the pair of numbers that are selected at each stage by placing them in braces, the combined value (if any) is given on the line below in square brackets].

3, 4, 3, {2, 5}, 2
3, {4, 3}, [3], 2
{3, [1]}, 3, 2
[2], {3, 2}
2, [1]

You have come to a halt and failed in your task.

On the other hand you could go:

{3, 4}, 3, 2, 5, 2
[1], {3, 2}, 5, 2
{1, [1]}, 5, 2
{5, 2}
[3]

And you have succeeded in your task.

For which of the following can you succeed in your task?

Row A: 9, 4, 1, 4, 1, 7, 1, 3, 5, 4, 2, 6, 1, 4, 8, 3, 2.

Row B: 2, 3, 5, 9, 6, 3, 1, 4, 2, 3, 1.

Row C: 1, 2, 3, 4, 5, 6, …, 997, 998, 999, 1000, 3, 5, 7, 9, 11, …, 993, 995, 997, 999.

Row D: 3, 2, 1, 4, 5, 4, 3, 2, 4, 3, 7, 4, 1, 5, 1, 4, 2, 4, 3, 1, 2, 7, 9, 3, 7, 5, 3, 8, 6, 5, 8, 4, 1, 5, 2, 3, 1, 4, 10, 6, 3, 5, 7, 4, 1, 4.

I have coloured the numbers in italics red, and those in bold green in an attempt to ensure the different styles of numbers can be differentiated.

When the problem was originally published there was a problem with the typesetting and the following correction was published with Enigma 1104:

Due to a typographical error, three of the numbers in Enigma 1101 “Disappearing Numbers” appear in the wrong font. In each case, the following should have been printed in heavy bold type:

the second number 3 in the initial example;
the first number 5 in row B;
and the first number 4 in the second line of row D.

I have made the corrections to the puzzle text above.

[enigma1101]

Enigma 410: Most right

From New Scientist #1560, 14th May 1987 [link]

The addition sums which Uncle Bungle has been making up recently, with letters substituted for digits, have been getting longer and more complicated. And no one will be surprised to hear that in the latest one everything is not as it should be. In fact one of the letters is wrong.

Here it is:

What can you say about the letter which is wrong? What should it be? Find the correct sum.

[enigma410]

Tantalizer 475: League table

From New Scientist #1026, 11th November 1976 [link]

Here is what is left of the league table pinned in our local church door at the end of the season. It shows the number of goals scored in each match rather than the mere result. Each side played each [other side] once and there were no ties in the “points” list.

You would think that the Anvils, having scored more than half the goals scored in the entire competition, must have done pretty well. But in fact, as you see, they came bottom. The Bears beat the Eagles and drew with the Furies. At least one team drew more games than the Casuals. The Dynamos — but that’s enough information.

Can you fill in the table?

[tantalizer475]

Enigma 1102: The Apathy Party

From New Scientist #2258, 30th September 2000

George called a meeting to inaugurate the National Apathy Party, open to anyone who has never voted in a General Election. He hopes to be the next Prime Minister. The turnout was phenomenal, but he managed to seat them all in Wembley Stadium (capacity 80,000). George proposed that the President and the Committee should be chosen by chance, rather than by ballot. The delegates had been allocated sequential membership numbers of arrival — George, of course, being No. 1. He proposed that one number be chosen at random by the computer — that member would be the President. All members whose numbers divide exactly into the President’s number would be on the Committee. Apathy reigned — this totally undemocratic procedure was agreed.

The computer produced an odd membership number for the President and the number of committee members, including George and the President, was an odd square greater than 10.

What was the President’s membership number?

[enigma1102]

Enigma 409: Hands and feet

From New Scientist #1559, 7th May 1987 [link]

There are six footpaths through our extensive local woods, one linking each pair of four large oaks. I decided to go on a long walk starting at one of the oaks, keeping to the footpaths, ending back where I started, covering each of the footpaths exactly twice, and never turning around part-way along a path.

Whenever I was at an oak my watch showed an exact number of minutes, and in the previous 30 seconds up to and including arriving at the oak or in the 30 seconds after leaving the oak the hour and minute hands of the watch were coincident.

I set out sometime after 6am and I was back home before midnight on the same day. I walked at a steady pace from start to finish.

What time was I at the oak at the start of my round walk, and what time did I get back there at the end of the day?

[enigma409]

Puzzle 68: Football and addition: letters for digits

From New Scientist #1119, 7th September 1978 [link]

In the following football table and addition sum letters have been substituted for digits (from 0 to 9). The same letter stands for the same digit wherever it appears and different letters stand for different digits. The three teams are eventually going to play each other once — or perhaps they have already done so.

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

Find the scores in the football matches and write out the addition sum with numbers substituted for letters.

[puzzle68]

Enigma 1103: Brush strokes

From New Scientist #2259, 7th October 2000

Our sign painter has an odd way of calculating his charges. For each continuous brush-stroke (which can be any shape but must not go over the same ground twice) he charges £1. He paints capital letters in a simple style and does not use two strokes where one would do. So, for example his U, E, G and H would cost £1, £2, £2 and £3 respectively.

My house number is a three-figure prime and I have asked the sign painter to spell out the three different digits (so that, for example, 103 would be ONE NOUGHT THREE and would cost £24). For my house number the cost in pounds equals the sum of the three digits and is also a prime.

What is my [house] number?

[enigma1103]

Enigma 408: Royal numbers

From New Scientist #1558, 30th April 1987 [link]

In the following subtraction sum, each letter stands for a different digit. Replace the letters with digits.

[enigma408]

Tantalizer 476: Take your partners

From New Scientist #1027, 18th November 1976 [link]

Amble, Bumble, Crumble and Dimwit had a jolly night of it at the Old Tyme ball. Each took his wife but did not dance with her. In fact each danced only three dances, changing partner each time, and spent the rest of the night in the bar.

In the Cha-Cha Amble danced with a wife larger than Mrs A and Bumble with a wife larger than Mrs B. Then came the rumba, with Crumble in the arms of a wife larger than Mrs C. Then they did the tango, in which Bumble had a wife smaller than Mrs B and Mrs B was squired by a man fatter than Amble. These were the three dances mentioned and no two men swapped partners [with each other] between the Cha-Cha and the rumba or between the rumba and the tango. No two wives are the same size.

What were the pairings for the rumba?

[tantalizer476]

Enigma 1104: Odd and even squares

From New Scientist #2260, 14th October 2000

In the following statement digits have been consistently replaced by capital letters, different letters being used for different digits:

ONE and NINE are odd perfect squares, FOUR is an even perfect square.

Find the numerical value of the square root of (NINE × FOUR × ONE).

[enigma1104]

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?

[enigma407]

Enigma 1105: Road ants

From New Scientist #2261, 21st October 2000

Take a large sheet of paper and a black pen and draw a rectangle ABCD with AB = 10 metres and BC = 2 metres. Now draw lines to divide your rectangle into small squares, each of side 1 centimetre. Place your diagram so that A is due north of D and B is east of A. In each small square draw the diagonal that goes from northwest to southeast. Let P and Q be the mid-points of AD and BC, respectively. Then there is a black line PQ; remove it and replace it by a red line.

Amber is a small ant who can walk along the black lines in your diagram. North of PQ she covers a centimetre in 1 minute, but south of PQ she can cover a centimetre in 30 seconds. She is to walk from C to A and she chooses the quickest route.

1. How long does Amber take on her journey? Give the time, to the nearest second, in hours, minutes and seconds.

Ben is another ant who walks along the black lines. North of PQ he goes at the same speed as Amber, but not south of PQ. The fastest time for Ben to get from C to A is 24 hours.

2. South of PQ, how long does Ben take to cover a centimetre? Give the time, to the nearest second, in minutes and seconds.

[enigma1105]

Enigma 406: The ritual

From New Scientist #1556, 16th April 1987 [link]

I entered the jungle clearing and found, at the centre, six stones numbered 1, 2, 3, 4, 5, 6. My native guide demonstrated the ancient ritual which was enacted on that site.

First I had to arrange the stones in any order I wished, so I put them as 421365. I then noted the number on the first stone — all counting is from the left — is was 4, and so I picked up the fourth stone and placed it at the right hand end. I obtained 421653. Next, I looked at the second stone, a 2, and moved the second stone to the end, to give 416532. I repeated the procedure for the third stone to give 416532, and then for the fourth, fifth and sixth stones, to give successively, 416523. 465231, 652314. The final arrangement was called the result of the ritual.

Just then the high priestess, Sarannah, entered. She arranged the stones in a certain order, carried out the ritual and obtained the result 314625. My guide explained that the arrangement Sarannah started with was the result of applying the ritual to a very special arrangement, which she could not tell me.

What was the arrangement that Sarannah started with?

[enigma406]

Puzzle 69: Division: letters for digits

From New Scientist #1120, 14th September 1978 [link]

For some reason Uncle Bungle does not like divisors. This has been left out in the latest division sum which he has produced with letters substituted for digits. Here it is:

Find the divisor and all the digits of the sum.

[puzzle69]

Enigma 1106: Not a square unused

From New Scientist #2262, 28th October 2000

Harry, Tom and I each found a set consisting of a 4-digit perfect square, a 3-digit perfect square and a 2-digit perfect square that between them used nine different digits; but none of us could add a 1-digit square with the unused digit because 9, 4, 1 and 0 all appeared in each of our three sets. No two of us found exactly the same set; none of the squares in my set appeared in either Harry’s set or Tom’s set. There is one further set that none of us found whose unused digit is again not itself a perfect square.

List in ascending order the three squares in this set that none of us found.

[enigma1106]

Enigma 405: Uncle bungles the answer

From New Scientist #1555, 9th April 1987 [link]

It is true, of course, that there are rather a lot of letters in this puzzle, but despite that I though that for once Uncle Bungle was going to write it out correctly. In fact there was no mistake until the answer but in that, I’m afraid, one of the letters was incorrect.

This is another addition sum with letters substituted for digits. Each letter stands for the same digit whenever it appears, and different letters stand for different digits. Or at least they should, and they do, but for the mistake in the last line across.

Enigma 405

Which letter is wrong?

Write out the correct addition sum.

Note: This is a corrected version of Enigma 401.

[enigma405]

Enigma 401: Uncle bungles the answer

From New Scientist #1551, 12th March 1987 [link]

It is true, of course, that there are rather a lot of letters in this puzzle, but despite that I though that for once Uncle Bungle was going to write it out correctly. In fact there was no mistake until the answer but in that, I’m afraid, one of the letters was incorrect.

This is another addition sum with letters substituted for digits. Each letter stands for the same digit whenever it appears, and different letters stand for different digits. Or at least they should, and they do, but for the mistake in the last line across.

Enigma 401

Which letter is wrong?

Write out the correct addition sum.

As it stands the puzzle has no solution. New Scientist published the following correction with Enigma 404:

Correction to Enigma 401, “Uncle bungles the answer”. Unfortunately, as a result of a printer’s error, New Scientist managed to bungle the question. We will publish the correct question, in full, in our issue of 9 April, as Enigma 405. In the meantime, our apologies to those who were thwarted by the mistake.

[enigma401]

Puzzle 70: Football five teams: new method

From New Scientist #1121, 21st September 1978 [link]

The new method of rewarding goals scored in football matches goes from strength to strength. In this method 10 points are given for a win, 5 points for a draw and 1 point for each goal scored. Once can get some idea of the success of the method from the fact that in the latest competition between 5 teams, when some of the matches had been played, each team had scored at least 1 goal in every match. They are eventually going to play each other once.

The points were as follows:

A   11
B    8
C   12
D    5
E   43

Not more than 9 goals were scored in any match.

What was the score in each match?

[puzzle70]

Enigma 1107: Factory work

From New Scientist #2263, 4th November 2000 [link]

When it comes to factor problems it is often quicker to use a bit of cunning logic than to resort to a computer or even a calculator, and here is one such puzzle.

Write down a four-figure number ending in 1 and then write down the next eight consecutive numbers, and then write down the nine numbers obtained by reversing the first nine. For example:

3721    1273
3722    2273
3723    3273
3724    4273
3725    5273
3726    6273
3727    7273
3728    8273
3729    9273

You could then count how many of all those numbers have a factor greater than 1 but less than 14: in this example there are actually eleven of them.

Your task now is to find a four-figure number ending in 1 so that, when you carry out this process, fewer than half the numbers have a factor greater than 1 but less than 14.

What is that four-figure number?

[enigma1107]

Enigma 404: Regular timepiece

From New Scientist #1554, 2nd April 1987 [link]

Enigma 404

My daughter has a regular hexagonal clock without numerals, as illustrated. I tried to fool her recently by rotating it and standing it on a different edge, but she recognised that the hands did not look quite right.

On the other hand, my son, has a clock on a regular polygon, again without numerals, which I can stand on any different edge and make the clock show the wrong time with its hands in apparently legitimate positions.

How many edges does this regular polygon have?

[enigma404]