# How to find the order of a Rubik's cube algorithm?

For example, the algorithm $$R U R' U'$$ has an order of $$6$$, that is, repeat the algorithms $$6$$ times to return to the original position. How would I go about finding the order of any other algorithm?

• It's difficult to answer that question without a bit more information. Personally I would use a computer, and I would use a package such as Magma or GAP (or Maple or Mathematica) that has built-in facilities for this kind of calculation. The elements (or algorithms as you refer to them) of the Rubk Cude group are usually represented as permutations of the 48 faces of the cube that move. Commented Sep 15, 2019 at 13:50
• To back up @DerekHolt's comment: you can find a gap tutorial on the Rubik's cube group here. Commented Sep 15, 2019 at 14:07

Just in case you just want an easy calculator (just by inputting in the algorithm in written notation and getting the result) for the 2 $$\times$$2$$\times$$2 - 5$$\times$$5$$\times$$5, see Michael Gottlieb's Online Order Calculator. (Note: You must input the algorithm with prime symbols in the font like this: R U R' U'. Also, this notation is SiGN notation for the $$3\times3\times3$$.) You can also use CubeTwister.

But if you want to find it by hand (use a physical cube),

• Label the corners 1 - 8 and the edges 1-12. Learn about cycle notation and permutations (specifically, cycle structures/cycle classes).
• The order of an algorithm is defined as:

LCM(

length corner cycle_1 $$\times C_1$$,length of corner cycle_2 $$\times C_2$$, ... , length of corner cycle_$$m \times C_m$$

,

length of edge cycle_1 $$\times E_1$$, length of edge cycle_2 $$\times E_2$$, ... , length of edge cycle_$$n \times E_n$$

),

(We take the Least Common Multiple of the lengths of cycles, because when we execute an algorithm which generates a $$k$$-cycle exactly $$k$$ times (and not until then), it will return all pieces in the $$k$$-cycle to the identity permutation.)

Where:

• There are $$m$$ disjoint corner cycles and $$n$$ disjoint edge cycles.
• 1-cycles count as cycles for piece orientation.
• Each and every $$C_i$$ has a value of 1 if its corresponding corner cycle's orientation sum is 0 (mod 3) or a value of 3 otherwise.
• Each and every $$E_j$$ has a value of 1 if its corresponding edge cycle's orientation sum is 0 (mod 2) or a value of 2 otherwise.

Important note:

• Michael Gottlieb's solver doesn't display duplicate cycle lengths to display to the user as the work. For example, if a corner cycle class is a two 2-cycle and a 3-cycle ({2,2,3}, and the edge cycle class is a 5-cycle, 3-cycle, and two 2-cycle ({5,3,2,2}), it would just show the LCM[{2,3,5}] and not the full LCM[{2,2,3,5,3,2,2}].)

In order to determine the orientation sum of corners and edges, obviously you need to establish an orientation convention.

• One corner orientation convention (assuming that your cube has the Rubik's color scheme) is, when holding the cube so that the white face is on top and the yellow face is on bottom, all corners whose stickers are white OR yellow in the top OR bottom faces are correctly oriented. They are twisted otherwise. Just visualize in which direction they are rotated. If a corner is twisted clockwise, assign that corner an orientation value of 1. If a corner is twisted counterclockwise, assign that corner a value of 2. If a corner is not twisted, assign it an orientation value of 0.
• One edge orientation convention is to have the same condition on the eight edges which have a white or yellow sticker. That is, if, say, the green-and-white edge is in the top face, and its white sticker is in the top face, it's oriented. If the green and white edge is neither in the top or bottom face (in the E-layer), if it can be put there with some combination of the moves {L,L',R,R',U,U',U2,D,D',D2} and its white sticker is in the top face, then it's correctly oriented. Assign that edge an orientation value of 0. Otherwise assign that edge an orientation value of 1.
• For the remaining four edges (which have neither white nor yellow stickers), if when they are moved into the U or D faces (again, with some combination of the moves {L,L',R,R',U,U',U2,D,D',D2} ), if the color of its sticker in the U OR D face matches the color of the front OR back face, then it's correctly oriented. Assign it an orientation value of 0. Otherwise assign it an orientation value of 1.

Example

After labeling the corners 1-8, labeling the edges 1-12, apply R U R U to a solved cube.

• The cycle structure you should get for the corners is a 5-cycle whose corner orientation sum is equivalent to $$0 + 0 + 0 + 2 + 2$$ (mod 3) $$= 1$$ (mod 3). So $$C_1$$ has a value of 3.
• There is a corner in a 1-cycle (which still counts as a cycle in this context) which is twisted counterclockwise: 2 (mod 3). So $$C_2$$ has a value of 3.
• The cycle structure you should get for the edges is a 7-cycle whose orientation sum is $$0 + 0 + 0 + 0 + 0 + 0 + 0$$ (mod 2) $$= 0$$ (mod 2). So $$E_1$$ has a value of 1.

Therefore, LCM($$5\times3$$,$$1\times3$$,$$7\times1$$) = LCM(15,3,7) $$=15 \times 7 = 105$$.

• I think your procedure will lead to too high orders. For example, consider an operation that does a combination of (a) cycle three corners, without any net orientation change, and (b) twist two other corners in place. Your formula would compute an order of $9$ because it handles "LCM of cycle lengths" separately from orientation changes. Actually the order is $3$. You need to compute the total order of each cycle separately, including orientation, and then take the LCM of them all. Commented Sep 15, 2019 at 21:25
• You are correct! Commented Sep 15, 2019 at 21:37
• I made the necessary corrections (both to the statement and to the example). What do you think? Commented Sep 15, 2019 at 22:27
• Yes, this looks better. (By the way, this is equivalent to taking the lcm of the lengths of the cycles of the sticker permutation). Commented Sep 15, 2019 at 22:36
• Wow, when you mentioned that, I ended up observing that there is a 9-cycle of corner stickers when you do a U-Perm of corners (a 3-cycle in the top layer which doesn't change orientation of any of the three corners) combined with a 2 twist algorithm to one of those three corners and a corner not in that 3-cycle. In other words, you are right AGAIN! I never looked at it that way. (You should write an answer about this!) The only time I recall that stickers were useful in "Cube Theory" was a proof of the $3\times3\times3$ Cube Law of Edge Orientation. Commented Sep 15, 2019 at 23:04