Skip to content


Subversion checkout URL

You can clone with
Download ZIP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

Computing the number of permutations of the complex puzzles

The class of complex puzzles were proposed and discussed on the forum.

The main contributers are Carl Hoff (wwwmwww), Andreas Nortmann, Matt Galla (Allagem).

In this post:

Andreas Nortmann computed the number of permutations of the Complex 3x3x3 using GAP. His source code can be found in that thread, and links to more discussion were also included.Although the result is "just a big number", it is related to actual solution of this puzzle, because the calculation sheds light on redundancy of pieces: removing "redundant pieces" will not change the number of permutations of the puzzle.

The goal of this project is to investigate more Complex puzzles, including vertex-turning cube, edge-turning tetrahedron, or face-turning dodecahedron, etc.

My method is

(1) to use Ruby code to generate a text file specifying the permutations of pieces or stickers and hence specify the group;

(2) to import the above text file into GAP, and compute the number of permutations and orbits.


  • Install Ruby:

and GAP system:

  • Download (or clone) the repo.

  • Then run:

ruby generate.rb shape turning_axes [piece-only]

where shape may be tetrahedron, cube, octahedron, dodecahedron or icosahedron, or any number no less than 3. If shape is a number, the shape is a 2D polygon with that number of sides.

turning_axes may be face, vertex, or edge. If shape is a number, this parameter may be dropped.

[piece-only] is an optional switch. If not given, the code will generate the permutation for both pieces and stickers. If given, it will only generate that for pieces.


ruby generate.rb cube face

ruby generate.rb tetrahedron edge piece-only

ruby generate.rb 4

If the puzzle is too large, the runtime may be very long or the memory is not enough depending on the spec of the machine.

  • The code will create a text file complex.g

  • Open GAP, and run complex.g by typing


Note: in GAP, always use "/" but not "\" in the path.

The "visibility" of pieces can be set in the determine_visibility method in class Piece. Through this method we can set, for example, only the common face, edge, corner pieces to be visible on the complex 3x3x3 to get a 3x3x3, and compute the number of permutations of a 3x3x3. But this operation is largely manually done by copying the orbits generated by GAP back into Ruby code.

Sanity check

For Complex face-turning tetrahedra (which is essentialy Jing's pyraminx), the number matches my manual analysis For Complex 3x3x3, the number matches Andreas Nortmann's result in the forum. When setting only the common pieces on 3x3x3 (with or without super stickers) to be visible, the numbers matches the known results.

Checkout results.txt for some results and analysis.

Result highlight

On the complex vertex-turning cube (or face-turning octahedron), the only redundant piece types are the counterpart of those on the complex 3x3x3:

  • core

  • four pieces moved by antipodal corners, e.g., [ UFR, DBL ]

  • inverted antipodal pieces

  • inverted core.

After removing these pieces, removing any other piece type will cause a reduction of the number of permutations.

Something went wrong with that request. Please try again.