This repository contains a Python script that calculates the number of states of a Rubik's Cube.
Python 3.11.2
The Rubik's Cube State Calculator is a Python script that determines the total number of possible states for a Rubik's Cube with dimensions n x n x n, where n represents the size of each side of the cube. It utilizes a mathematical algorithm to compute the total number of unique configurations.
The script takes into account the dimensions of the cube to accurately calculate the number of states. Whether you have a 2x2x2, 3x3x3, or any other size of the Rubik's Cube, this script can calculate the total number of possible configurations.
The way in which the number of states is calculated, is as follows:
- To even cubes:
#n = 7! * 3⁶ * (24!)^k(k - 1) / (4!)^6(k-1)²
In which n = 2k, can you clear k and something like this would remain:
k = n / 2
- To odd cubes:
#n = 8! * 3⁷ * 2^10 * (24!)^k(k - 2) / (4!)^6(k - 1)(k - 2)
In which n = 2k - 1, can you clear k and something like this would remain:
k = (n + 1) / 2
-
Python 3 or higher
-
math library (included in the Python standard library)
- Clone the repository:
$ git clone git@github.com:Fuan200/cube_states.git
-
Open the repository.
-
Run the script:
$ python cube_states.py
-
You will be prompted to enter
n. -
Enter the value of
nand press enter. -
The script will calculate and output the number of possible states of those cube.
Note: The value n only can be between 2 and 8.
This project was inspired by the following video on Youtube:
In this video Mayoneso explains how the formula works in more depth.
💙 Juan Antonio Díaz Fernández - Fuan200