powered by
Fast version of cycle detection that only returns cycle length and unique state count without storing all intermediate states. Useful for testing many operation sequences efficiently. Implemented in C++ for performance.
get_reachable_states_light(start_state, allowed_positions, k)
List containing:
Total number of moves to return to start state
Number of unique states in the cycle
Integer vector, the initial permutation state
Character vector, sequence of operations to repeat
Integer, parameter for reverse operations
result <- get_reachable_states_light(1:10, c("1", "3"), k = 4) cat("Cycle length:", result$total_moves, "\n") cat("Unique states:", result$unique_states_count, "\n")
Run the code above in your browser using DataLab