I have a cube and on each face there is a different digit (written in modern digital style, so that, for example, a 2 would look the same either way up). My viewpoint from the front stays the same in all that follows; it is the cube which moves. By a “top twist” I mean that the front face in view moves to the top, by a “right twist” that the front face in view moves to the right, etc., each time bringing a new face into view.

I start by looking at the face in view. Bottom twist, look again, bottom twist, look again, bottom twist, look again. In all I have read off, quite correctly placed, a four-figure perfect square.

Left twist and ready to start again. Look at the face in view, left twist, look again, top twist, look again, top twist, right twist, look again. I have now read off, quite correctly placed, another four-figure perfect square.

Now for a fresh start. I look at a face, left twist, look again, left twist, look again, left twist, look again. I have read off, quite correctly placed, a four-figure number which is exactly twice a perfect square.

Top twist, top twist and ready to start again. Look at the face in view, left twist, look again, left twist, look again, left twist, look again. This time I have read off, quite correctly placed, a four-figure number which is *not* a perfect square.

What is that last number?

Of the digits 1-9 depicted on a 7-segment display, (0, 1, 2, 5, 8) read the same when inverted, (3, 4, 7) do not make digits when inverted and (6, 9) read as each other when inverted. None of the digits can be read when rotated through a quarter turn (in either direction). (Although I suppose you could argue that 0 can).

I wasn’t sure from the description whether you were allowed to have a face with a 6 on, and a different face with a 9 on (which would let you construct numbers with two 6’s or two 9’s), or whether only one face was allowed the 6-segment pattern because it could be read as either a 6 or a 9 depending on the orientation.

In the Python 3 program below I allow for both a 6 and a 9 to be present (because it talks about “different digits”, rather than “different patterns”). It runs in 58ms.

Solution:The final 4-digit number read off the cube is 5189.The first number read off the cube is 7921 = 89².

The second number read off the cube is 5625 = 75² (actually the faces we see are 5, 6, 2, 1, 5, but the 4th digit is not recorded).

The third number read off the cube is 1568 = 2×28².

The faces of the cube (at the start) are (U, D) = (6, 1), (L, R) = (8, 5), (F, B) = (7, 2).

The program produces two solutions one using the pattern “6” (one way up) and one using the pattern “9” (the other way up). If we didn’t allow pattern “9” (because it is the same as pattern “6”) the program would produce a single solution (you can remove the declaration for

digits[9]at line 22 to see this).You can also modify the declaration for

digits[0]to have it read 0 in any orientation, but that gives no additional solutions.I reckoned to have found a solution with a cube made up from this net:

0

1 8 9 5

2

(i.e. 0 on the top face, 2 on the bottom).

The numbers that came up were 1521, 2601, 1568.

Did I make a mistake somewhere?

@Hugh: I think this is quite a difficult puzzle, and it’s easy to get lost when following the instructions. I ended up making a paper cube to check I’d got a working solution.

You should find four 4-digit numbers, not three, so one of them is missing somewhere.

Also 1521 cannot be the first 4-digit number read off, as the sequence: “look; bottom twist; look; bottom twist; look; bottom twist; look” records faces: Front, Up, Back, Down, and as all the faces have different digits on we can’t record 1 from both the Front and Down faces (regardless of their orientation).

The second 4-digit number does visit the same face twice, so 1521 could be that number, but if the cube you give is set up to give 1521 as the second number the first number read off would have to have been 0528, which isn’t a square (and also starts with a zero).

So I think you must have gone wrong somewhere in your solution.