By way of @ajk_44 at NRICH, a belter of a puzzle:

You have 27 small cubes - three each of nine distinct colours. Can you arrange them in a cube so that each colour appears once on each face?

(Alison has created a Geogebra widget for you to play with, should you want to do that before reading on to the spoilers below the line.)

Terminology

Before anything else, let’s get our terms straight. The 27 cubes can be grouped into four classes: vertices, of which there are eight; edges, of which there are 12; centres, of which there are six; and one in the very middle.

I’ll also label the six faces front, back, left, right, top and ground (rather than bottom, so that they all have different initial letters.)


“It can’t possibly be done!”

My first systematic thought was “what happens if I put this colour in one of the corners? Where can its friends go?”

The answer to that is “not in many places.” The corner lies on three faces, leaving only eight possible places for the remaining two cubes to go - three centres, four edges and the middle.

Here, I blundered: I reckoned that the only possible way to pick two of those eight without a clash on any face was one on an edge and one at a centre - and given that there are only six centres available, it couldn’t possibly be done. There would be two corners left over.

Hang on a second

What about the middle? The middle could be the same colour as two opposite corners, and this would solve that counting problem: two of the eight corners could be the same colour, and the remaining six would all be different colours.

We’d also use up six of the edges, leaving six more unspecified. That works out as two per face (because each edge lives on two sides), and I’d hope to be able to colour those appropriately.

Making it work

I did do this using the widget, but I think it might be clearer and easier to follow ((especially for the colour-blind)) using numbers on a grid. Throughout, the left-hand grid represents the ground layer and the right-hand grid the top layer. The middle one, unsurprisingly, is in between. The left- and right-most columns of each grid are the left and right faces, and the top and bottom rows the back and front faces, respectively.

The first step is to put the middle in place, with its two friends arranged in opposite corners:

1 - - - - - - - -

        • 1 - - - -
                • 1

I then worked from the ground-left-front corner, putting its friends in the back centre and the top-right edge:

1 - - - 2 - - - -

        • 1 - - - 2 2 - - - - - - - 1

Because I like symmetry, I thought the best thing to do next was to fill out the diametrically opposite positions with the next colour:

1 - - - 2 - - - 3 3 - - - 1 - - - 2 2 - - - 3 - - - 1

Now, that is interesting. The first three colours line up in columns - a different column in each grid, and each a rotation of the one before. Let’s move on to the next corner, and stick a 4 in the ground-back-right. I’ll pick the top-front edge and left centre to go with it, like so:

1 - 4 - 2 - - - 3 3 - - 4 1 - - - 2 2 - - - 3 - - 4 1

… and again, match these with their opposites (although, for reasons of Emerging Symmetry, I will jump to number 7):

1 7 4 - 2 - - - 3 3 - - 4 1 7 - - 2 2 - - - 3 - 7 4 1

The ground-front-right corner can be 5, matched with the back-left edge and the top centre:

1 7 4 5 2 - - - 3 3 - - 4 1 7 - 5 2 2 - 5 - 3 - 7 4 1

And, diametrically opposite, let’s put 9:

1 7 4 5 2 - 9 - 3 3 9 - 4 1 7 - 5 2 2 - 5 - 3 9 7 4 1

Doing it colour-wise, I was crossing my fingers at this point that it would all work, but with numbers it’s pretty obvious where the remaining cubes go - the 6s where the columns with 4 and 5 and rows with 3 and 9 meet, and the 8s where the 7/9 columns meet 2/5.

1 7 4 5 2 8 9 6 3 3 9 6 4 1 7 8 5 2 2 8 5 6 3 9 7 4 1

And there we are! The top and ground grids have each digit once, as do the left and right ones, and the front and back.

But there’s more

As an added bonus, so do each of the middle slices - which means you could cut off any face and move it to the other side of the cube, as often as you liked, and it would still work. You could also swap any pair of parallel slices, as often as you liked.

In the representation I’ve gone for, each horizontal slice is the same as the one before it, shifted forward one and right one (wrapping around in an obvious way).

There are plenty of questions I don’t have answers to, though, the main one being: is this the only solution (up to symmetry)? I’ll leave that as an exercise for the interested reader.