Enigmatic Code

Programming Enigma Puzzles

Enigma 479: Road island

From New Scientist #1630, 15th September 1988 [link]

On the faraway island of Roadio, the quaint villages with the curious one letter names A, B, C, …, S are joined by a network of roads as shown:

Enigma 479

The numbers indicate distances between villages in miles. I have written on all the distances I remember, however I also recall that, by road, no village is more than 20 miles from D and no village is more than 29 miles from P. What is the maximum distance between any two villages on the island?

[enigma479]

Enigma 1032: Colonial powers

From New Scientist #2188, 29th May 1999

The old colonial powers had simply drawn lines on the map when they established the colonies of Abongo, Ebongo, Ibongo, Obongo and Ubongo. As a result, the map of the five colnies was a rectangle with each colony being a right-angled triangle. Abongo, Ebongo and Ibongo each had the same area. Obongo was bigger and Ubongo was bigger still.

After independence, Abongo, Ebongo and Ibongo united to form a single triangular country, larger than Ubongo.

On an old map of the five colonies, the shorter side was 60 centimetres long.

What was the length of the longer side?

When it was originally published the information that the combined country was the largest was omitted. A correction was published along with Enigma 1043 (along with the reassurance: “All Enigmas are checked to ensure they have a unique answer”). Without this fact there are three possible solutions.

[enigma1032]

Tantalizer 439: High life

From New Scientist #990, 4th March 1976 [link]

The Enigma Quartet all live on different floors of a mammoth block of flats. Amble and the drummer are on adjacent floors. The harpist lives four floors above Bumble. Crumble and the flautist are ten floors apart.

None of the four lives on a floor served by a lift. For, although there are three lifts all serving floor 0, one stops only at every third floor, one only at every fourth and one only at every fifth. Apart from floor 0, no floor has three lifts stopping.

Since no musician will ever walk up stairs. Amble has no way of visiting the trombonists flat without walking down at least four sets of stairs. Which instrument does Dimwit play and which floor does he live on?

[tantalizer439]

Enigma 478: Football, addition, letters and a twist

From New Scientist #1629, 8th September 1988 [link]

In both the football league table and addition sum below, letters have been substituted for digits. Each letter stands or should stand for a different digit (from 0 to 9), and different letters should stand for different digits. And so they do except for the fact that one of the letters is incorrect on one of the occasions on which it appears (if indeed it appears more than once).

The three teams are eventually going to play each other once, or perhaps they have already done so.

Enigma 478

Which letter was wrong? What should it be?

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

[enigma478]

Enigma 1033: Squirrels up and down

From New Scientist #2189, 5th June 1999

Samantha and Douglas are counting the squirrels visiting their garden. They record the monthly total for each of the 15 months January 1998 to March 1999. Samantha calculates that the number of squirrels is increasing, for she divides the 15 months into three five-month periods and finds the five-month totals are increasing with time. For example, there were more squirrels June to October 1998 than January to May 1998. But Douglas says the number of squirrels is decreasing, for he divides the 15 months into five three-month periods and finds the three-month totals decreasing with time, for example there were fewer squirrels April to June 1998 than January to March 1998.

1. Could there have been a total of 4 squirrels for the two months April and May 1998 and fewer than 75 squirrels for the whole of the 15 months? If so, how many squirrels were there for the 15 months?

2. Could there have been a total of 5 squirrels for the two months April and May 1998 and a total of fewer than 65 squirrels for the 15 months?

3. Could there have been 107 squirrels in June 1998 and 100 squirrels in October 1998? If so, how many squirrels were there in the 15 months?

4. Could there have been 108 squirrels in June 1998 and 100 squirrels in October 1998? If so, how many squirrels were there in the 15 months?

[enigma1033]

Puzzle 34: We compete. Who does what?

From New Scientist #1085, 12th January 1978 [link]

The jobs of my five employees, Alf, Bert, Charlie, Duggie and Ernie, have been changing rather frequently lately and I am afraid that I have got slightly out of touch. It was rather important for me, however, to find out who does what, as they had recently been having a test designed to find out more about their assorted capabilities and it was clearly important for the Managing Director to know just what had been happening in the past so that he could predict the future.

The information that I managed to get about their jobs and their places in the test (in which there were no ties) was as follows:

1. Bert was as many placed below the Worker as he was above the Door-Knob-Polisher.

2. The Door-Opener was three places above Charlie.

3. Alf’s place was even and the Door-Shutter’s place was odd.

4. The Bottle-Washer was two places above Ernie.

In what order did they come in the test, and what were their jobs?

[puzzle34]

Enigma 477: Gap ‘n enigma

From New Scientist #1628, 1st September 1988 [link]

In the following long multiplication I’ve replaced digits with letters in some places and left gaps in the rest. Where letters are used, different letters are used for different digits.

Enigma 477

That’s all you actually need, but to avoid hours of work I can also tell you that GAP is divisible by 9.

What is the value of IMPINGE?

[enigma477]

Enigma 1034: Double-digit squares

From New Scientist #2190, 12th June 1999

Four of us were trying to find a one-digit perfect square, a two-digit perfect square, a three-digit perfect square and a four-digit perfect square, such that five different digits were each used twice to form them. To make matters harder for ourselves we agreed that one of those five digits must be 7. Since we remembered that both 0 and 1 are perfect square we were each able to chose a different one-digit square.

We each found a valid solution, and our solutions had no squares in common.

List in ascending order the other squares in the solution that had 9 as its one-digit square.

[enigma1034]

Tantalizer 440: Grunt

From New Scientist #991, 11th March 1976 [link]

Grunt is an after-shave lotion so maddening to women that the wearer can count on at least a broken leg in the rush. How curious then that some mad males are still using Phew. The makers of Grunt are so puzzled that the recently hired Judy the judo champion to look into it.

Judy soon discovered that she found both products equally repellant. So she decided she had better work scientifically. Boarding a strike-bound London bus, all of whose passengers were male, she set to with a questionnaire. Each passenger in turn informed her, “I am using Grunt myself. The man you have just asked is using Phew”. Each, that is, except the first man, who said only, “I am using Grunt”, but added afterwards, “The last man you asked is using Phew”.

Puzzled herself, Judy then asked a few selected passengers how many men were using Phew. The ugliest man said “19”, and then man she had originally interviewed next but three after him said “24”. The fattest said “13” and one she had originally interviewed next but four after him said “28”. The rudest said “24”, and the one she had originally interviewed next but five after him said “13”.

Given that each man used one of the other and that all and only those using Grunt told the truth, can you say how many were using Phew?

[tantalizer440]

Enigma 476: A curious question

From New Scientist #1627, 25th August 1988 [link]

Kugelbaum wandered into a history lecture by mistake and, almost as quickly, but not by mistake, wandered out again. “1210 may well have been a dull year,” he said to himself, “but it’s an interesting number. The first digit gives the number of 0s in it, the next the number of 1s in it, the next the number 2s in it and so on, quite consistently, right up to the very last digit. And there are other such numbers too, such as 2020 and 3211000! Curiously, I can’t find one with six digits, though.”

As he sought vainly the room where he was to give his lecture on number theory he amused himself by calculating all the numbers having this property. “I wonder,” he remarked as he looked into broom cupboard, “if one were to take all the numbers having this property and add them together, what the result would be?”

What is the sum of all the numbers having the property that their first digit gives the number of 0s in the number, the next the number of 1s in the number, the next the number of 2s in the number and so on, consistently right through to and including the last digit of the number?

(Since 10, 11, 12 and so on are not digits, any such number containing more than 10 digits must have zeros in its 11th place and any other places after this).

Note: The original puzzle statement gave 211000 as an example, not 3211000.

[enigma476]

Enigma 1035: Connected numbers

From New Scientist #2191, 19th June 1999

Take a large sheet of paper and write on it the numbers, 5, 6, 7, …, 999998, 999999, 1000000. You are now going to draw lines that connect pairs of the numbers as follows. Start with 5. Split 5 into two numbers, both larger than 1, in as many ways as you can. So 5 = 2 + 3. Multiply the two numbers together. Now 2 × 3 = 6, so draw a line connecting 5 and 6. The next number is 6. Now 6 = 2 + 4 = 3 + 3 and 2 × 4 = 8 and 3 × 3 = 9, so draw a line connecting 6 and 8 and another connecting 6 and 9. The next number is 7 = 2 + 5 = 3 + 4, and so we draw a line that connects 7 and 10 and another connecting 7 and 12.

Repeat the procedure for 8, 9, 10, …, in turn. Note that when a product is larger than 1000000 then no line is drawn, for example: 500002 = 2 + 500000 = 3 + 499999 = …, so a line is drawn connecting 500002 and 1000000 but no line is drawn for 3 × 499999 = 1499997.

1) When your diagram is complete, are there two numbers, both less than 250000, such that there is no path along the lines connecting one to the other?

Now for your second task, take another piece of paper. You want to write the numbers 5, 6, 7, …, 98, 99, 100 on it, and then copy onto it, from your first piece of paper, all the lines connecting numbers which are both less than or equal to 100.

2) Can you complete your second task in such a way that no two of the lines in fact cross?

[enigma1035]

Puzzle 35: Letters for digits — a multiplication

From New Scientist #1086, 19th January 1978 [link]

In the multiplication sum below the digits have been replaced by letters. The same letter stands for the same digit whenever it appears, and different letters stand for different digits.

Write the sum out with letters replaced by digits.

[puzzle35]

Enigma 475: Dance hall

From New Scientist #1626, 18th August 1988 [link]

At the dance there are 10 girls, Ann, Babs, Cath, Dot, Emma, Fay, Gwen, Hazel, Irene and Jane, and 10 boys. Jane knows one boy and Tom knows one girl, but I cannot tell you who they know. However, I can tell you all the other acquaintances:

Ken knows D, F;
Len knows E, H, I;
Mac knows B, F, G, I;
Ned knows A, B, H;
Owen knows E, G, I;
Pat knows A, B, C, D;
Quentin knows E, G;
Ray knows A, C;
Sam knows C, E.

The first dance pairs them off as follows:

Ann takes the hand of the first boy she knows, Ned (first always means first in alphabetical order), Babs does the same to Mac, then Cath, to Pat, then Dot, to Ken, then Emma, to Len. When Fay approaches Ken she finds he is holding Dot’s hand and the procedure becomes more complicated.

They form a line of the dance floor, F, K-D and ask the first boy who knows any girl on the floor to come out, bringing any girl that is holding his hand. The line becomes F, K-D, M-B. The procedure is repeated to give F, K-D, M-B, N-A. Repeating adds P-C to the line. Repeating again adds Ray to the line and the procedure stops as he has his hands free. The we have the line F, K-D, M-B, N-A, P-C, R.

Now Ray takes the hand of the girl he knows who is nearest to Fay in the line, Ann, and she releases Ned’s hand. Ned repeats the procedure Ray used and takes the hand of Babs who releases Mac. Mac repeated the procedure and takes the hand of Fay. That completes the pairing for Fay’s round.

The procedure is repeated for Gwen, Hazel, Irene, and Jane in turn. The pairing obtained after Jane’s round includes C-S, D-K, F-M, H-N and I-L.

Who do Jane and Tom know?

Note: I corrected a typo in the original puzzle while transcribing this (and I hope I didn’t introduce any more myself).

[enigma475]

Enigma 1036: Multiple shifts

From New Scientist #2192, 26th June 1999

George’s young son has been playing with numbered cards and has discovered an interesting curiosity. Having placed six cards on the table to show the number 179487, he then moved the right-hand card to the left to form the number 717948. A quick check on his calculator confirmed that this number is exactly four times the first number.

George congratulated his son on this discovery, and then challenged him to find the smallest number which can be multiplied by four simply by moving the last digit to the front.

Can you find this number — and the smallest number that can be multiplied by five in similar fashion?

[enigma1036]

Tantalizer 441: Luck of the draw

From New Scientist #992, 18th March 1976 [link]

Dopey confessed that he had never learnt to play chess and was appointed umpire. The other six dwarves settled down to play a five-round tournament. Grumpy drew with everyone but Sneezy and finished equal bottom with Doc, whom he had played in the first round. Sneezy drew with Doc, Happy and Sleepy. Bashful drew with Sleepy. There were no other draws.

There was at least one draw in each round and each dwarf drew in at least two consecutive rounds. The two equal winners did not play each other in the second round.

What were the pairings in the final round?

[tantalizer441]

Enigma 474: More goals

From New Scientist #1625, 11th August 1988 [link]

In this football league table, the sides are eventually going to play each other once, but, of the figures given, one is incorrect.

Enigma 474

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

Which figure is wrong? What should it be? Find the score in each match.

[enigma474]

Enigma 1037: The perfect shuffle

From New Scientist #2193, 3rd July 1999

I recently took an ordinary pack of playing cards and placed them on the table, face down. Somewhere in the pack the four aces were together, and in places further down the kings were together, the queens were together, and the jacks were together.

I then did the “perfect shuffle”. In other words I took the top 26 cards in my left hand, and the other 26 in my right, I flicked the bottom left-hand card on to the table, followed by the bottom right-hand card on top of it, followed by the next left on top of them, next right, next left, and so on. The cards remained face down at all times.

My fellow players were so impressed with this performance that I did three more perfect shuffles with the same pack. When I had finished, the arrangement of suits within the pack was exactly the same as when I started (for example, the top card was a heart before and after the four shuffles, the next was a spade before and after the four shuffles, and so on).

Counting from the top, what was the position of the ace of hearts after the four shuffles?

[enigma1037]

Puzzle 36: Football (4 teams: old method)

From New Scientist #1087, 26th January 1978 [link]

Four football teams — ABC and D — are all to play each other once. After some of the matches have been played a table giving some details of the number of matches played, won, lost etc. looked like this:

(2 points are given for a win and 1 point for a draw).

Find the score in each match.

A correction was published with Puzzle 39, as follows:

In the solution to Puzzle 36, the table should have shown that D played one match. The error is regretted.

I have made this change in the table above.

[puzzle36]

Enigma 473: Family ties

From New Scientist #1624, 4th August 1988 [link]

Eight players took part in a “round robin” chess tournament; that is, each player played each of the others exactly once. No game resulted in a draw. The players were four women and their husbands.

After the tournament, when each player had told me just the total number of games which he or she had won, it was possible to work out the results of all the games except those between Mr King and Mrs Bishop, Mr King and Mrs Castle, and Mrs Bishop and Mrs Castle.

The King couple won between them the same number of games as the Queen couple did. All the men won between them the same number of games as the women did. Two of the women were disappointed to have been beaten by both Mr King and Mr Bishop.

What were the results of the four games between married couples? (For example, Mr X beat Mrs X, Mrs Y beat Mr Y).

[enigma473]

Enigma 1038: The running track

From New Scientist #2194, 10th July 1999

Bill takes five minutes to complete one lap of a circular running track, whereas Chad takes only four minutes. They set off together at the starting point and ran anti-clockwise. Before completing one lap, Chad reversed his direction of running. They stopped running when both of them happened to be at the start point at the same instant (for the first time after the start).

Given that they crossed each other five times while running, how long did Chad run anti-clockwise?

[enigma1038]