I was asked to find the ways of winning noughts and crosses in a $3\times3\times3$ cube. I worked it out. Then I was asked to work out $4\times4\times4$. Following that, I was asked to derive a formula that would work for any number of boxes on the cube (i.e $n^3$). I worked this out to be $3n^2 + 6n + 4$ = number of winning ways. This worked, however I noticed that with no cube when $n = 0$, there is still $4$ ways to win.
Can someone please help me conceptualize this.
If my explanation of the problem is not good enough for you to understand go to this link:
I figure there are three dimensions.
In each dimension there are $n$ slices of the cube. And in each slice there are $n$ distinct lines that traverse only in that one dimension. (e.g. in a 4x4 cube there are four wall slices and each slice has 4 rows.) So there are $n^2$ lines in that dimensions. Asumming lines traversing one dimension only are distinct from lines traversing the other dimensions this accounts for $3n^2$ lines.
But this assumption fails for $n = 1$. In $n=1$ the one winning line is vertical while simultaneously being horizontal, and front to back. I have triple counted. For $n=0$ there is trivially no problem yet as $3*0^2 =0$.
Diagonal lines traverse in two dimensions. In each dimensional slice there are two diagonal lines in each slice. If $n > 1$ we can safely assume these lines are distinct from the previously counted lines that only traverse in one dimension. These account for $3*(2n)$ more lines.
Again, the fails miserably for $n = 1$. The one line is all of horizontal, veritical, front-to-back, diagonal in all 6 possible ways. We have nonagonally over-counted. We've counted 9 lines where there is only 1. For $n=0$ we trivially haven't had a problem yet.
The last type of line are those that traverse in all 3 dimensions. These go from vertex to opposite vertex. As a cube has 8 vertices that are $4$ such lines.
Which obviously fails for $n=1$ as there is only one vertex that is its own opposite and the one line is the same one we have already counted 9 times. So we have overcounted a whopping 13 times. As for $n = 0$, there are clearly no vertices so this is overcounting by $4$.
So.. number of ways to win: If $n \ge 2;$ $3n^2 + 6n + 4$, for $n=1; 2$ for $n=0; 0$.