# 1212 Last Layer Orientations and Permutations



## axelx8 (Oct 21, 2011)

So I'm writing an essay; more specifically, my Extended Essay, on cubing specifically specializing in mathematics behind it.
I've created equations to find all the orientations and permutations on an N x N x N cubic puzzle for N = 2k or N = 2k + 1 where k is an integer or natural number.
For N = 2k + 1

\( \frac{(8)!*(12(N-2))!*((2)^{(12(N-2))})*((3)^8)}{12} \) \( * \) \( ((6(((N-2)^2)-1))!*(6(((N-2)^2)-1))^{(6(((N-2)^2)-1))}) \)

For N = 2k

\( \frac{(8)!*(12(N-2))!*((2)^{(12(N-2))})*((3)^8)}{12} \) \( * \) \( ((6((N-2)^2))!*(6((N-2)^2))^{(6((N-2)^2))}) \)

Though I feel that the equation is not correct since Mr. Hardwick mentioned something about:

\( \frac{N-2}{2} \)

Something about wing edges and sharing the same orbit. I don't clearly understand it.

Also, I have not been able to find a clear and absolute method of finding the number of orientations and permutations for centers as well as parity for centers if any exist. 

Now this can give me the correct amount of numbers for 3x3x3 but I have not actually determined if it has worked for an actual N x N x N. Any revisions would be helpful. Also can be applied to any layer of the cube with (N - X) solved layers.

Also more on par with the title, I was wondering after AUF, how do we narrow down the number 15552 down to 1212 orientations and permutations. I've been slaving for hours trying to calculate a way to remove inverses and mirrors but have not been successful so any insight would be great.


Thanks.
(Yes I overdid it with the parenthesis but I did it to make sure since it's for my IB Diploma).


----------



## Christopher Mowla (Oct 21, 2011)

I made a formula for the number of last layer orientations on the nxnxn cube based off of cuberBruce's vector function. I will direct you to a thread in this sub-forum, specifically, start reading from here onward. The only thing I want you to get out of the first post that comes up is the attachment I attached to it. This gives the number of permutations for a given orbit of wings. At the end of the pdf document, there are images for the OLL cases for wings.

The posts following that post leads to the formula. I give a full documentation in the last post in that thread on how I made it. Be sure to see all three attachments in that thread (all PDF's). If you have any questions about my work, feel free to ask.

Also,
There are \( \frac{n-2}{2} \) orbits of wings on even cubes and \( \frac{n-3}{2} \) orbits of wings on odd cubes. We can express them both if we use the floor (greatest integer function) \( \left\lfloor \frac{n-2}{2} \right\rfloor \) or as \( \frac{n-2-\left( n\bmod 2 \right)}{2}=\frac{n-2-\sin ^{2}\left( \frac{n\pi }{2} \right)}{2} \).


The term _oribit_ means the place a particular piece type can go. If you look at an _n_x_n_x_n_ cube which has \( n-2-\left( n\bmod 2 \right)=n-2-\sin ^{2}\left( \frac{n\pi }{2} \right) \) inner layer slices that contain wings, we only need to count half of these slices to represent the number of orbits (which I already have shown above). Each symmetrical pair of inner layer slices that contain wings is one orbit.



axelx8 said:


> Also, I have not been able to find a clear and absolute method of finding the number of orientations and permutations for centers as well as parity for centers if any exist.


Centers do not have orientations, only permutations. The number of permutations of centers which have parity is equal to the number of the permutations without parity. That is, the number of permutations of centers with parity is the (total number of permutations)/2. I won't get into too much detail (because it is unclear to me as to why you would need to know this for your main objective), but you may find the spoilers in this post helpful.

If you're wondering about supercube centers, I have recently edited this post and put a lot of formulas in it. The first formula, which is the formula the others are based off of, is derived in the spoiler in this post from the previous thread I provided a link for in this post.

EDIT:
And for the number of OLLs formula, note that \( \left\lfloor \left\lfloor \frac{n}{2} \right\rfloor -\frac{n}{2} \right\rfloor =-\left( n\bmod 2 \right)=-\sin ^{2}\left( \frac{n\pi }{2} \right) \).

EDIT:
Oh, and the "number or permutations of wings" I was referring to in the very first document was the number of cases where all wings are "oriented." The number of permutations of wings in general is something different all together (sorry!).

EDIT:
Lucas Garron and cuBerBruce did canonicalizations for the various cycle possibilities of 8 objects (how many wings are in each orbit of wings in the last layer). Lucas showed his code here. So I assume the total number of "distinct" permutations of wings for each orbit of wings in the last layer is the sum of all the canonicalization results for each cycle type. I'm sure either one of them can do the calculations for you or direct you to a place where it might have already been done.

A nifty formula you can use to get the full number of permutations for each cycle type can be found here. If you apply the formula right, if you add the numbers of each cycle type you got from the formula together, you should have 8!-1. So you add one (the solved case) to get 8! total permutations of 8 objects. Like I said though, Lucas and Bruce did canonicalizations of some of the cycle types via programming. I'm not sure if there is a mathematical way of doing this, as I did it by hand for some cycle types, and it's just trial and error.


----------



## axelx8 (Oct 21, 2011)

@cmowla I was wondering about parity on a supercube now. I was looking at the spoilers but I can't distinctly narrow down a reason why parity exists with centers. 
As for the reason why I need to know this, the topic in which I'm working with is pretty exclusive to me within my entire school. Not even my adviser knows what I'm talking about and I can't create a claim such that "parity exists on centers" without logical proof.

EDIT:

When I was looking at this prior to making this post, I looked at the meaning of supercube and I'm also confused as to what would be a supercube and what would not be one.

EDIT:

Never mind that last edit. I can presume that anything past a 3x3x3 is a supercube.


----------



## cuBerBruce (Oct 21, 2011)

axelx8 said:


> Never mind that last edit. I can presume that anything past a 3x3x3 is a supercube.


 No, the difference between a normal cube and a supercube is in the stickers. It doesn't matter what the size is, except it is only relevant on 3x3x3 and larger cubes. On a supercube, every piece is distinguishable from every other piece, and all orientations of pieces (notably the centermost piece on each face) are distinguishable.


----------



## axelx8 (Oct 21, 2011)

@cuBerBruce Thanks for clarifying that for me. It makes things easier for me to work on my equation without having to worry about creating a supercube equation.


----------



## Christopher Mowla (Oct 21, 2011)

Just in case you didn't see, I edit my first post with more information. But to respond to what you asked about supercubes, (and this, as you just found out doesn't help you figure out what you are aiming to, but...)

See the two images in this post, and refer back to my explanation in the spoiler of this post. In the first image, I show that an inner layer quarter turn does a 2 4-cycle of the X-center pieces within it (the center pieces along both diagonals of a big cube center are referring to as X-center pieces).

So what do we mean by center orbits? See Chris Hardwick's matrices which models all orbits for both even and odd cubes here. Basically, if you were to imagine 1/4 of a big cube center, that is, the "composite corner" block of a big cube center, each center piece within that rectangle (odd cubes) or square (even cubes) represents a different orbit of centers. As Chris Hardwick says in that post, there are \( \frac{\left( n-1 \right)}{2}\frac{\left( n-3 \right)}{2}=\frac{\left( n-1 \right)\left( n-3 \right)}{4} \) center orbits on odd cubes and \( \frac{\left( n-2 \right)}{2}\frac{\left( n-2 \right)}{2}=\frac{\left( n-2 \right)^{2}}{4} \) orbits of centers on even cubes. That includes the X-center orbits.

The second image in the first post I linked to in this post shows that a quarter turn of the outer layer (Chris Hardwick calls it the "toggle operation" in his thread on his matrix method) can do a 2-cycle (odd permutation) of wings and corners, but that's if we do a 3-cycle to each orbit after we do the outer layer quarter turn to solve back 2 of the 4 pieces of each messed up by the quarter turn. That is, an odd number of outer layer quarter turns does a single 4-cycle (odd permutation) of X-center pieces, so they get parity from the toggle operation. All other orbits of centers can get an odd permutation from the toggle operation as well if we look at cube sizes larger than the 4x4x4 (since a quarter turn of an outer layer slice also does a 4-cycle of all center orbits), but a subset of the non X-center orbits can also be put in a 4-cycle by inner layer slices that contain them as well. (To see why I said only a subset of them, see the second spoiler in this post).


Spoiler



Although I have already linked you to the center formulas for supercubes, note that there are \( n-3 \) center orbits in each individual inner layer slice. Each inner layer slice on one half of a cube (that is, 0 to \( \left\lfloor \frac{n-2}{2} \right\rfloor \) non-symmetrical slices) contains one orbit of wings each (there are 4 wings in each inner layer slice, all of which are in the same orbit, obviously). Note that there is not \( n-2 \) center orbits in each individual slice because each orbit of X-center pieces has 8 pieces in each slice, not 4 like the rest.

Given that you have _w_ orbits of wings (which can range from 0 to \( \left\lfloor \frac{n-2}{2} \right\rfloor \)), \( w^{2} \) center orbits are shared (the intersection) between each slice considered (and again, we can consider 0 to \( \left\lfloor \frac{n-2}{2} \right\rfloor \) slices on one half of a cube). 

So we cannot just say there are \( w\left( n-3 \right) \) orbits of centers in _w_ slices (which contain _w_ orbits of wings) because that would be an over estimate.

In other words, if you were to define the number of orbits of wings and orbits of centers in _w_ slices (from 0 to \( \left\lfloor \frac{n-2}{2} \right\rfloor \), either all on the right or all on the left, excluding the central inner layer slice on odd cubes), for multiple slices we have \( w+w\left( n-2 \right)-w^{2} \) total orbits of pieces. The _w_ by itself is the number of wing orbits, and the rest is the number of center orbits.

Of these center orbits, \( w^{2} \) of them are in an even permutation, despite the fact that we have done a quarter turn of all inner layer slices we are considering. 

So this gives the formula \( w\left( n-2 \right)-w^{2}-w^{2}=w\left( n-2 \right)-2w^{2} \), which is the same as the formula I linked to, only I used the variable _r_ instead of _w_ (for no particular reason I guess). It is the number of orbits of centers in an odd permutation for _w_ orbits of wings in an odd permutation.

For the \( w^{2} \) subset of centers in an even permutation, Chris Hardwick displays this subset of the center orbits by substituting for each matrix entree (represent one center orbit each) with \( 0_{L} \). (The "click" operation is merely selecting which inner layer slices we want to do a quarter turn to) and this subset of center orbits is shown with colors other than dark blue, red and yellow in this image




​ Note that \( w^{2} \) center pieces (which are not red, yellow, or dark blue) are both in the top half and bottom half of this image. Both subsets of \( w^{2} \) center pieces reresent the same orbits, so that's why we subtract the first \( w^{2} \) (when I said that that amount is shared between slices already). The other set of \( w^{2} \) center pieces we can therefore use as the sole representation of those particular center orbits shared between the (3) slices shown in the image which are in an even permutation.

So, whether by an outer layer (all center orbits), or by an inner layer (all center orbit types besides X-center orbits), we can do a 4-cycle (odd permutation) to the center orbits, and therefore have parity. Obviously this implies that an odd permutation is parity (which is what we mean when we say parity).





Spoiler



There can only be a subset of center orbits in a odd permutation by inner layer slices because the maximum number of center orbits which can be in an odd permutation by inner layers only is \( \left\lfloor \frac{1}{2}\frac{\left( n-2 \right)^{2}}{4} \right\rfloor \), which is less than the total number of center orbits which are not X-center ones).


----------

