## Enigma 1760

Spoiler for New Scientist Enigma 1759: “Squares and cubes” (Follow the link to see the puzzle.)

The number which is both a square and a cube must be a sixth power: 26 = 82 = 43 = 64, or 36 = 272 = 93 = 729.

Note that the only cubes with 2 or 3 digits are 27, 64, 125, 216, 343, 512, and 729.

Try 64 at 6 down. Then 6 across must be a square: 625 or 676. If 625 then 5 down has middle digit 5 which means it’s 256. Then 7 across can only be 64, which duplicates. If 6 across is 676 then there is no possibility for 2 down. So 6 down is not 64.

Try 64 at 3 down. Then 4 across is 144, 324, 484, or 784. If 144 then 2 down must be 216 or 512. The former leaves nothing for 1 across; the latter forces 1 across to be 25. 5 down must be 441 or 484 (400 is ruled out because we don’t allow a leading zero for 7 across), but no 3-digit cube ends with 8 so it’d have to be 441. Then 7 across must be 16, 6 across is 324, and 6 down is 36. If 4 across is 324 the middle digit of 2 down is 3, but there are no 3-digit squares or cubes with 3 as the middle digit. If 4 across is 484 or 784 then 5 down is 841 and 7 across is 16. In the 484 case 2 down must be 144 or 441 or 841, none of which leaves anything for 6 across. In the 784 case 2 down must be 576 or 676 either of which leaves nothing for 6 across.

The other possibilities are 729 at 2 down or 5 down. 5 down doesn’t work because it leaves nothing for 7 across.

With 729 at 2 down, 6 across can only be 196, with 6 down being 16. Then 5 down must be 169, 361, or 961. The first leaves nothing for 7 across while the latter two leave only 16, which duplicates.

So there is indeed only one solution:

 2 5 6 1 4 4 3 2 4 6 1 6

## Enigma 1711

Spoiler for New Scientist Enigma 1711:

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?

In a cubic lattice n cubes on a side, there are n3 small cubes which if separated would have 12n3 edges. In the lattice 12n of these edges lie on the edge of the big cube; each contributes 1 rod to the total. There are 4n2 edges lying in the each of the 6 faces of the big cube, of which 4n2–4n in each face are not on an edge of the big cube, or in total 24(n2n) such edges; each coincides with another such edge so each contributes 1/2 rod to the total. Left over are 12n3–12n–24(n2n) edges which lie in the interior of the big cube; each coincides with three other such edges so each contributes 1/4 rod to the total. Therefore there are 12n+12(n2n)+3n3–3n–6(n2n) = 3n3+6n2+3n = 3n(n+1)2 rods. For n = 1, 2, 3, 4… this is 12, 54, 144, 300… rods. So the installation art cube is 4 rods on a side.

So now how many ways can you draw the shortest path between diagonally opposite vertices? If we label the three mutually perpendicular edge directions as north/south, east/west, and up/down, then each such path starting from the south/west/downwardsmost vertex must contain exactly four steps to the north, four to the east, and four upwards. That is, 12 steps, four of each of three kinds. Or more generally, 3n steps, n of each of three kinds. The number of possibilities is (3n)!/(n!)3. For n = 1, 2, 3, 4… this is 6, 90, 1680, 34650… possible paths. So a full cycle for an n=4 cube at 10 seconds per path is 346500 minutes seconds or 240 4 days, 15 hours minutes.