# Formula for Calculating Positions of a NxNxN Cube?

#### goodatthis

##### Member
Is there any sort of finite formula that you can simply plug in for N, with an being the order of a cube? I looked online and found something like that, but it had things that had to do with computer programming and modulus, which I can't really say I understand. Is there a more simple approach, like (and I'm completely utterly making this up, and it probably wouldn't even make sense)
((3LogBASE(N)(8!))*(LogBASE(N)(12!))*((N-1)^2))/(64N^3)

And if there's a good website that I just haven't found yet, link to that would be great.

#### GlowingSausage

##### Member
There is one somewhere on this forum.
I'll go look for it.
BRB

edit: here's the thread (I'll get more specific soon):
http://www.speedsolving.com/forum/s...alculating-Permutations-on-nxnxn-Rubik-s-cube

edit2: this post helped me a few weeks/months ago (page 2):
Yeah, you've got to know the syntax.

Here is Chris' formula which takes into account orientations as well.
Here is his adjusted formula that ignores orientations (that is, if I understood the changes he said to be made).

So, from the first formula (which I think Sharkretriver was really after):
2X2X2, 3X3X3, 4X4X4, 5X5X5, 6X6X6, 7X7X7, 10X10X10, 100X100X100, 1000X1000X1000, etc.

Last edited:

#### GlowingSausage

##### Member
clicky

erase the 1000s and enter your number of choice

edit: or copy and past this and replace the #####s with your number

((24*2^10*12!)^Mod[#####, 2] 7!3^6 24!^Floor[(#####^2 - 2 #####)/4])/4!^(6 Floor[(##### - 2)^2/4])

example (for 7x7x7):
((24*2^10*12!)^Mod[7, 2] 7!3^6 24!^Floor[(7^2 - 2 7)/4])/4!^(6 Floor[(7 - 2)^2/4])

Last edited:

#### cmhardw

##### Premium Member
Is there any sort of finite formula that you can simply plug in for N, with an being the order of a cube? I looked online and found something like that, but it had things that had to do with computer programming and modulus, which I can't really say I understand. Is there a more simple approach, like ...
The formula I listed on my site uses the floor function and the mod function to combine the following two formulas into one:

Number of combinations to the N x N x N cube when N is even and N>0:
$$\frac{7!*3^6*(24!)^{\frac{n^2-2n}{4}}}{(4!)^{6\left(\frac{(n-2)^2}{4}\right)}}$$

and

Number of combinations to the N x N x N cube when N is odd and N>1:
$$\frac{(8!*3^7*12!*2^{10})*(24!)^{\frac{n^2-2n-3}{4}}}{(4!)^{6\left(\frac{n^2-4n+3}{4}\right)}}$$

--edit--
If you're familiar with the floor and ceiling functions, then for n an integer you can replace n (mod 2) with:
$$\lceil\frac{n}{2}-\lfloor\frac{n}{2}\rfloor\rceil$$

Last edited:

#### Christopher Mowla

##### Premium Member
There's always this which only has integers and n and works for both odd and even n (n>1).

(I bet Chris can guess how I found this!)

EDIT:
The number of K4 OLLs formula is more complicated, obviously, but it looks kind of "similar" to the above (when in this form):

Last edited:

#### cmhardw

##### Premium Member
There's always this which only has integers and n and works for both odd and even n (n>1).

(I bet Chris can guess how I found this!)
I can guess how you derived that Very cool! I like how you handled the even and odd cube sizes with the (-1)^n terms to adjust the exponents when necessary. Without having looked into this much I am surprised that the 3 factor does not have a (-1)^n term in its exponent. I'm not doubting your formula, I'm just pleasantly surprised at how the cubie-verse works out sometimes

EDIT:
The number of K4 OLLs formula is more complicated, obviously, but it looks kind of "similar" to the above (when in this form):

Again, I really like how you handled the odd/even issue using only (-1)^n. Neat!

#### Christopher Mowla

##### Premium Member
I was surprised that the 3 factor didn't have (-1)^n too!

I made this number of positions formula from my trig function one, here. (For those who haven't seen, the derivative to that function is in the next post). I ran it through Mathematica as Factor[Simplify[my trig formula]], and it gave me:

Of course, $$\cos \left( n\pi \right)=\left( -1 \right)^{n}$$ and $$\text{cos}^{2}\left( \frac{n\pi }{2} \right)=\frac{1+\left( -1 \right)^{n}}{2}$$ for integers n. I just made those substitutions and rearranged everything algebraically.

I took a similar approach to achieve the number of OLLs formula from the one in the link in my signature, as it's equivalent (for the integers) to:

#### Christopher Mowla

##### Premium Member
that 96577 seems pretty out of place there, weird.
It may seem so, but 96577 = (13)(17)(19)(23).

So the number of positions formula can be written as a product of exponents of all prime numbers between 1 and 23 (inclusive).

That is, the number of positions formula can be written as:

In addition, I just got that the derivative can be written as:

So we simply multiply the number of positions formula by this factor to get the rate of change.

EDIT:
Chris, now I know you're being modest! You have taken on some impressive feats yourself.

Last edited:

#### goodatthis

##### Member
Boy, I thought that my measly Algbera 2/Trig class was complicated, I feel like such a nub now haha.

#### cmhardw

##### Premium Member
Boy, I thought that my measly Algbera 2/Trig class was complicated, I feel like such a nub now haha.
When I read cmowla's posts I feel like a nub too

I first tried to understand Richard Carr's formula for the number of combinations to the N x N x N cube in my sophomore year in college. Once I figured out what he was doing I then spent about a month or two, also in sophomore year college, to derive the formulas for the supercube as well as the super-supercube. It helps to have studied some combinatorics, as well as Proof by Induction. Combinatorics helps to derive a formula, and Proof by Induction helps you see if the formula you wrote actually does what you think it should do.

#### cmhardw

##### Premium Member
Is their a more simple formula for 2x2?
Number of combinations to the N x N x N cube when N is even and N>0:
$$\frac{7!*3^6*(24!)^{\frac{n^2-2n}{4}}}{(4!)^{6\left(\frac{(n-2)^2}{4}\right)}}$$
Let n=2
$$\frac{7!*3^6*(24!)^{\frac{2^2-2*2}{4}}}{(4!)^{6\left(\frac{(2-2)^2}{4}\right)}}$$

$$\frac{7!*3^6*(24!)^{0}}{(4!)^{6\left(0\right)}}$$

$$7!*3^6$$

#### G2013

##### Member
Bump?
Suddenly I got interested in combinations, and I wanted to know if my logic is right:

Combinations of the [R, U] group:
Corners: 6!/2 permutations and 3^5 orientations
Edges: 7!/2 permutations and 1^6 orientations
(6!/2*3^5)*(7!/2)=220449600

Is that correct?

#### Carrot

##### Member
Bump?
Suddenly I got interested in combinations, and I wanted to know if my logic is right:

Combinations of the [R, U] group:
Corners: 6!/2 permutations and 3^5 orientations
Edges: 7!/2 permutations and 1^6 orientations
(6!/2*3^5)*(7!/2)=220449600

Is that correct?
That is not correct. (The corner permutation needs to be 6!/(2*3) )

EDIT: Stefan just ninjaed me like a ninja..

#### G2013

##### Member
Well, at least he didn't explain it, so I'll have to try to understand 6!/(2*3)
If I don't get it, could someone explain it?

The /2 is because permutation parity, right?
And the /3 is because... I don't get it. I know that an A perm is not possible, but that's just a J (perm parity) and a U perm... I thinked for some minutes but I can't get it... Why two thirds of the permutations aren't possible? Because... no idea. I'll think some more

Well, I wrote that above while I was thinking for a reason, but after 20 minutes I give up.