Pesky Permutations

Algorithmic - 170 Points

One of my favorite pastimes is solving my Rubik’s Cube. In fact, I’ve fiddled with it so much that I noticed a pattern: If you repeat the same algorithm on the cube, it will eventually return to its original state.

Can you give me the average number of permutations each algorithm in perms.dat takes to return the cube to solved? Round your answer to 2 decimal places and submit without sctf{}.

Good Luck!


I decided to use the Python library PyCuber to solve this challenge and apply every line of moves on a Cube checking every time if it was solved.

This is the script I wrote

#!/usr/bin/env python

import sys
import os
import pycuber as pc

c_sum = 0
solved = pc.Cube()
cubes = 0

with open("perms.dat") as f:
   content =

for form in content:
   c = pc.Cube()
   alg = pc.Formula(form)
   cubes += 1

   counter = 1
   while c!=solved:
   print(str(cubes)+" -> "+str(counter))
   c_sum += counter


After a lot of time and Distributed Computing, we came up with the following sum (rounded):


This is the file with line numbers and moves numbers if you want to check: perm.txt