[math-fun] Method for magic cubes