You have $4n$ cubes, $n>7$ , that can have eight different colors, and you arrange them into a $2 \times 2 \times n$ cuboid, so that no two cubes of the same color meet at a side, an edge or a vertex.

Lets take the colors to be - red, orange, yellow, green, blue, teal, cyan and magenta.

Given that the four cubes on one end are red, orange, yellow, and green, how many ways are there of coloring four cubes on the other end?

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.

With this arrangement, every row of $2 \times 2$ cubes needs to necessarily contain different colors than the row before it. So, if we call the colors on one end $1$ , $2$ , $3$ , and $4$ . Then every other row must contain the colors $5$ , $6$ , $7$ , and $8$ .

So, if $n$ is odd, the four colors on the other end must be red, orange, yellow and green. If $n$ is even the four colors on the other end must be blue, teal, cyan and magenta.

Either way, you have four colors to paint on four cubes, so you have $4! = \boxed{24}$ ways to do this.