## Teaser 2890: Squares on cubes

**From The Sunday Times, 11th February 2018** [link]

Liam has a set of ten wooden cubes; each has a different number (from 1 to 10) painted on one face (the other five faces are blank). He has arranged them in a rectangular block with all numbers upright and facing outwards. Each vertical side of the block shows some numbers which can be read as a number that is a perfect square. No two square numbers have the same number of digits.

Which square number must be present?

[teaser2890]

## Jim Randell 2:51 pm

on28 November 2019 Permalink |The cubes are placed on the table, so that the numbers are showing on vertical faces. They are then slid around on the table to arrange them into a contiguous rectangular block with all the numbers showing on the outside vertical edges of the block.

The cubes must be arranged into a 2×5 block (a 1×10 block is not possible), and each of the 4 vertical sides of the block reads as a square number. And each of the 4 square numbers has a different number of digits.

The sides composed of 2 blocks cannot involve 10 (as none of 10, 10_, _10 are square numbers), so they must display square numbers made of 1 number (1 digit) and 2

numbers (2 digits) and the 5 block sides must show squares made of 3 numbers (3 digits) and 4 numbers (5 digits, including 10).

This Python program runs in 103ms.

Run:[ @repl.it ]Solution:The square number 9 must be present.The three possible arrangements for the square numbers are:

Here is a diagram of the first arrangement.

Imagine the cubes are laid out like a 2×5 block of chocolate viewed from above. The numbers are etched on the the sides of the cubes. But the block has started to melt and so the bottom of it has splayed out, allowing us to see all four of the square numbers when viewed from directly above:

LikeLike

## GeoffR 8:23 am

on30 November 2019 Permalink |Without the constraint that the digit one is the duplicated digit, I found three more possible sets of squares:

(4,36,289, 51076)

(9,36,784,21025)

(9,25,784, 36100)

@Jim: Please confirm your run-time for this code.Thanks,

LikeLike

## Jim Randell 8:43 am

on1 December 2019 Permalink |@Geoff: On my machine I get a comparative runtime of 377ms for the code you posted (using the

gecodesolver – thechuffedsolver fails on this model).LikeLike