Rubik's cube with different neighboring color How many valid configuration of the 3x3x3 Rubik's cube are there so that no two adjacent faces are the same color?
Thanks.
 A: Computing this exactly seems extremely challenging.
I wrote some Rust code (below) to scramble a cube 10 million times and test whether two adjacent stickers are the same color. On my machine, it took a few minutes to run and produced the number 56. Multiplying this by 43 quintillion total states, empiricrally there are around 241 trillion such states. This is far too many to brute-force search without some very powerful pruning.
use std::sync::Mutex;

use cubesim::{prelude::*, FaceletCube};
use rand::seq::SliceRandom;
use rayon::prelude::*;

const PRINT_EVERY: usize = 100_000;
const ITERATIONS: usize = 10_000_000;
const BATCH_SIZE: usize = 1000;

const SCRAMBLE_LENGTH: usize = 30;

#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, Hash)]
struct Stats {
    completed: usize,
    next_print: usize,
}

fn main() {
    let all_moves = cubesim::all_moves(3);

    let stats = Mutex::new(Stats::default());

    let spooky_states: usize = (0..ITERATIONS / BATCH_SIZE)
        .into_par_iter()
        .map(|_| {
            let mut ret = 0;

            let mut rng = rand::thread_rng();

            for _ in 0..BATCH_SIZE {
                let mut cube = FaceletCube::new(3);

                for _ in 0..SCRAMBLE_LENGTH {
                    cube = cube.apply_move(*all_moves.choose(&mut rng).unwrap());
                }

                if is_spooky(&cube) {
                    ret += 1;
                }
            }

            let mut stats = stats.lock().unwrap();
            stats.completed += BATCH_SIZE;
            while stats.completed >= stats.next_print {
                println!("Completed {}", stats.next_print);
                stats.next_print += PRINT_EVERY;
            }

            ret
        })
        .sum();

    println!("{spooky_states} states out of {ITERATIONS} are spooky.")
}

fn is_spooky(cube: &FaceletCube) -> bool {
    !cube.state().chunks(9).any(|face| {
        face[0] == face[1]
            || face[1] == face[2]
            || face[3] == face[4]
            || face[4] == face[5]
            || face[6] == face[7]
            || face[7] == face[8]
            || face[0] == face[3]
            || face[3] == face[6]
            || face[1] == face[4]
            || face[4] == face[7]
            || face[2] == face[5]
            || face[5] == face[8]
    })
}

Dependencies:
[dependencies]
cubesim = "0.0.7"
rand = "0.8.5"
rayon = "1.5.3"

