You have 27 cubes of the following colors:

- 9 orange
- 9 green
- 9 blue

How many ways can you put them together to forma a 3x3x3 cube so that no row in any of the three Cartesian directions ( $x,y$ , and $z$ ) contains the same color?

Assume that all the cubes of one color are indistinguishable, so if you swap two it counts as the same arrangement.

Also, assume that the edges of the 3x3x3 cube are aligned with the x, y and z axes.

**
Image credit:
**
http://www.paintingandvino.com/

The answer is 24.

**
This section requires Javascript.
**

You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.

If we number the nine cubes on the bottom as follows:

There are

sixways to pick 1 and 2.Then, given 1 and 2, there are

twoways to pick 4.After that, there is only one way to pick the remaining cubes on the bottom layer.

Therefore, there are $6 \cdot 2 =$

12ways to pick the cubes on the bottom layer.Now, if we start on the second layer, there are

twoways to pick the top left cube. Once this has been done, the colors of all the remaining 17 cubes are determined.Therefore, in all there are $12 \cdot 2 = \boxed{24}$ ways to pick the cubes.