# Enigmatic Code

Programming Enigma Puzzles

## Teaser 2784: Three lives

From The Sunday Times, 31st January 2016 [link]

I think of a whole number from 1 to 20 inclusive and Andy has to try to guess the number. He starts with three lives and makes successive guesses: after each guess I tell him whether it is right or too low or too high. If it is too high he loses one of his lives. To win the game he has to guess my number before his lives run out. He has developed the best possible strategy and can always win with a certain number of guesses or fewer. In fact no-one could be sure of winning with fewer guesses than that “certain number”.

What is that “certain number”?

[teaser2784]

## Enigma 1774: March of the ants

From New Scientist #2942, 9th November 2013 [link]

A vertical piece of string is attached to a flat horizontal sheet of chicken wire, which forms a lattice of regular hexagons with 1-centimetre-long sides. The string is attached at one of the joints between three hexagons. Six ants marched down the string and along the wire, always moving further from their starting point on the wire. After a while, they had all marched the same distance along the wire (which was a whole number of centimetres less than 20 centimetres), but they were all at different straight-line distances from the starting point.

If I told you one of these straight-line distances, you would be able to calculate the straight-line distances the other five ants were from the starting point.

How far had the ants marched along the wire?

[enigma1774]

## Enigma 1769: Crossing lines

From New Scientist #2937, 5th October 2013 [link]

I have drawn a number of straight lines across a large sheet of paper, each extending from edge to edge on the paper, so that each line crosses all the other lines. One of the intersections is between three lines, all the others are between just two lines, and none of them are on the edge of the paper. I counted the number of non-overlapping areas formed that did not touch the edge of the paper and found that this was exactly three times the number of non-overlapping areas that did touch the edge of the paper.

How many lines did I draw?

[enigma1769]

## Enigma 1765: Repeating digits

From New Scientist #2933, 7th September 2013 [link]

I have before me some positive whole numbers, each consisting of a single digit, which may be repeated. The digit is different for each number, and the number of times it is repeated is also different for each number.

The sum of my numbers is a number in which each digit is larger than the digit on its left, and it is the largest number for which this is possible, given the constraints described above.

What is the sum of my numbers?

[enigma1765]

## Enigma 1750: Navigating the grid

From New Scientist #2918, 25th May 2013 [link]

Using the number grid shown (A) it is possible to generate nine-digit numbers in the following way: Start on any square and then move horizontally, vertically or diagonally to an adjacent square that hasn’t already been visited. Repeat until all nine squares have been visited. For example, the path shown in diagram B generates the number 235968741.

I have listed all the numbers that can be generated in this way, and that end in a certain digit. Some of these are divisible by four (and only four) of the numbers 1 to 9. The rest are divisible by five (and only five) of the numbers 1 to 9.

How many numbers are there in my list?

[enigma1750]

## Enigma 1745: Cutting cubes

From New Scientist #2913, 20th April 2013 [link]

I have before me a number of solid cubes. I make a single straight cut through each of them, avoiding cutting through any of the vertices. The resulting solids have between them the same number of even-sided faces as odd-sided faces. The number of cubes I started with is the minimum compatible with the information given above.

How many cubes did I start with?

[enigma1745]

## Enigma 1741: Four squares

From New Scientist #2909, 23rd March 2013 [link]

I have before me five two-digit numbers, with no leading zeros. All the digits are different and none of the numbers is prime. The sum of the five numbers is a perfect square. If I remove one of the numbers, the sum of the remaining four is also a perfect square. If I remove another number, the sum of the remaining three is again a perfect square, and if I remove a third number, the sum of the last two is again a perfect square.

What are my five numbers?

[enigma1741]

## Enigma 1735: A pile of coloured cubes

From New Scientist #2903, 9th February 2013 [link]

I have several boxes, each containing a number of cubes. Each cube has black and white faces (at least one of each colour per cube), and each box contains all possible different cubes, with no duplicates. My three nephews opened the first box and each tried to assemble their own 2×2×2 cube with only one colour on its outer faces, and of course they failed. They then opened further boxes until they were each able to assemble a single-coloured 2×2×2 cube. They then put all the leftover cubes from the open boxes in a pile.

How many cubes were there in the leftover pile?

[enigma1735]

## Enigma 1727: Common factors

From New Scientist #2894, 8th December 2012 [link]

I have in mind three consecutive two-figure numbers and I have calculated their sum and their product. I have then listed those positive integers which divide exactly into both that sum and product. It turns out that there are just six numbers in that list and that the sum of the six numbers is odd.

What are the three consecutive two-figure numbers?

[enigma1727]

## Enigma 1719: Taking averages

From New Scientist #2886, 13th October 2012 [link]

I have before me a pile of nine counters numbered one to nine. I take two counters from the pile and write down the average of the numbers made by arranging them in two ways, that is in their original order and reverse order.

I then take a third counter from the pile and calculate the average of the numbers made by arranging the three counters in all possible orders. I repeat this until I have used all nine counters, ending up with eight averages. All but one of these averages are whole numbers, and the one that isn’t can be accurately written to one decimal place.

How many counters were used to generate the average that isn’t a whole number?

[enigma1719]

## Enigma 1711: Illuminated artwork

From New Scientist #2878, 18th August 2012 [link]

In our town square is a piece of installation art consisting of 300 rods of equal length arranged in a cubic lattice. The whole structure balances on a single vertex, with the diagonally opposite vertex at the top. Each rod contains an LED strip light, which can be independently switched on and off. A microprocessor controls this, lighting up the rods that form the shortest continuous path between the bottom and top vertices.

Each combination of rods (meeting the shortest continuous path criterion) is lit up for 10 seconds, then another and so on, until all combinations have been displayed, when the cycle starts again.

How long does it take to complete a full cycle?

[enigma1711]

## Enigma 1702: All the sixes

From New Scientist #2869, 16th June 2012 [link]

I have before me six different six-digit numbers, whose sum also contains six digits. Each of the 42 digits has one of only two values. If I told you the sum, you would be able to identify all six numbers.

What is the sum?

[enigma1702]

## Enigma 1697: Binary palindrome

From New Scientist #2864, 12th May 2012 [link]

I have before me a number, which when written in binary is palindromic and has n digits. If I told you the value of n, and you wrote a list of all the possible palindromic binary numbers of length n, your list would have n numbers in it.

If your list was in ascending numeric order, and I told you the difference between my number and the next higher number in the list, you would be able to identify my number.

What is my number, in decimal form?

[enigma1697]

## Enigma 1694: The town clock prank

From New Scientist #2861, 21st April 2012 [link]

Our town clock has a standard 12-hour face, divided into 60 minute marks. The hands do not move smoothly: the minute hand moves sharply on to the next minute mark at the end of each minute, and the hour hand moves at the end of each 12 minutes.

The other day, a prankster swapped the hands (an operation that only took a few seconds between movements of the mechanism). Immediately after the swap, the clock showed the wrong time, but it was a valid time; in other words, the relative positions of the hands made sense. Within the next 10 minutes, the clock had shown the right time for exactly 2 minutes.

What time did the clock show immediately before the hands were swapped?

[enigma1694]

## Enigma 1689: What’s my number?

From New Scientist #2856, 17th March 2012 [link]

Three very logical friends, Amy, Bob and Carol, sat in a circle wearing hats. Each hat had a number on it so all three could see the others’ numbers but not their own. They were told that the numbers were three different positive digits.

They each made a statement in turn and were told to raise their hands when they knew their own number. Amy said: “Carol’s number is greater than Bob’s.” No one raised their hand.

Bob then said: “The sum of Amy’s and Carol’s numbers is even.” On hearing this, Carol raised her hand. Even then Amy and Bob did not raise theirs. But, after a pause, and once it had become clear that Amy wasn’t going to raise her hand, Bob raised his and then Amy raised hers.

What were Amy’s, Bob’s and Carol’s numbers?

[enigma1689]

## Enigma 1686: Squaring the circle

From New Scientist #2853, 25th February 2012 [link]

A builder was contracted to pave a circular courtyard with square paving slabs having sides of length 1 metre. The radius of the courtyard was an exact number of metres. The slabs had to be laid in a rectangular grid with no gaps, and with four slabs meeting at the centre of the circle. The slabs at the edge obviously had to be cut, but the builder had to cut as few slabs as possible.

When he was finished, the builder found he had cut exactly a third of the slabs (he didn’t re-use any of the discarded pieces).

How many slabs were used, and what was the radius of the courtyard?

[enigma1686]

## Enigma 1683: Lottery numbers

From New Scientist #2850, 4th February 2012 [link]

A lottery draw, which is televised, uses balls numbered 01 to 39, from which five winning balls are selected and displayed in a row. By the magic of the producer’s graphics software, they are then rearranged into ascending order from left to right, to make checking easier.

One week, two of the winning balls had values less than 10, and the number obtained by reading (from left to right) all 10 digits as a single number was exactly 10 times the number similarly obtained after the balls had been rearranged.

What were the numbers of the five balls, in their original order?

[enigma1683]

## Enigma 1678: Tennis tournament

From New Scientist #2844, 24th December 2011 [link]

My tennis club held a knockout tournament, in which eight players competed. The two losers of the semi-finals played a match to decide 3rd and 4th places. Matches were decided by the best of five sets, with the match ending once a player had won three sets. Two matches had to be abandoned due to poor weather. When this happened the winner was the player who had won the most completed sets when the match was abandoned – luckily this didn’t lead to a draw on either occasion.

At the end of the tournament no two players had played the same number of sets, and all players except the winner had lost more sets than they had won.

How many sets were played overall?

[enigma1678]

## Enigma 1659: Pairs of numbers

From New Scientist #2825, 13th August 2011 [link]

I have before me four two-digit numbers, all eight digits being different. I have grouped them into pairs, such that the product of the two numbers in each pair is the same, and is a perfect cube.

What are the four numbers?

[enigma1659]

## Enigma 1665: Football league

From New Scientist #2831, 24th September 2011 [link]

My local football league has five teams, which each play each of the other teams twice. Three points are given for a win, and 1 point for a draw. At the end of the season, all five teams tied with the same number of points, so they were ordered by goal difference, which gave a clear winner. The team that drew the most games also won a game against the team that came top of the league.

How many games did the team that came top of the league win, draw and lose?

[enigma1665]