# Number of ways to stack N cubes

I'm trying to figure out how many ways are there to stack N cubes on top of each other.

Once you get a particular stack of 4 cubes let's say, the order of the cubes doesn't matter, just which sides are being shown does.

I'm generally finding 2 numbers:

1.) 6 * 24^(n-1)

and

2.) 3 * 24^(n-1)

Which is the correct answer, and why?

To understand the question better, you can refer to the Instant Insanity puzzle:

http://en.wikipedia.org/wiki/Instant_Insanity

-
What does "stacking cubes" mean here? It's not clear. –  Robin Chapman Oct 7 '10 at 9:57
Think of each cube with a different number on each side. So how many different possible stackings are there, one cube on top of the other. –  Sev Oct 7 '10 at 10:00
I've also edited the question to include a link to the original puzzle: and also the same link here - en.wikipedia.org/wiki/Instant_Insanity –  Sev Oct 7 '10 at 10:01
I LOVED this game when I was little. You have sufficiently allured me to buy a copy for my office. I had kinda forgotten it existed. :) –  BBischof Oct 8 '10 at 2:15

Your solutions presuppose that the cubes are identical; this is not the case in Instant Insanity. If they are all distinguishable you are missing a factor of $N!$.

The smaller possible solution is valid under the assumption that a stack is regarded as identical with that stack produced by turning the original stack upside down. The larger solution regards these two stacks as different.

-
Thank you. Just a comment about the factor of N! I stated above that the order of the cubes don't matter. –  Sev Oct 7 '10 at 15:57

I would say 6*24(n-1). The first cube can be placed in 6 ways, just choosing the top face. Then you select one side as the front. The second cube can then be placed in 24 ways as you choose the top and then which one will be front. Each successive cube has 24 ways to be placed. So you multiply all these numbers.

Another way to look at it is that each cube has 24 possibilities, but they fall into groups of four by rotating the whole stack.

-

I suspect that the Wikipedia article's number of $41,472 = 24^4 / 8$ arrangements of the four cubes comes from the idea that each of the four cubes can have 24 orientations. However, the whole stack can be rotated into any of four positions, removing a factor of 4 without altering the four visible side face patterns.

In addition, the whole stack can be turned upside down (or equivalently, since order does not matter, each cube can be turned upside down) without altering the four visible face patterns, just whether you encounter them clockwise or anti-clockwise. That removes a further factor of 2.

So Wikipedia uses your $3 \times 24^{n-1}$ answer.

-