simplify both permutations_recursive and permutations_dynamic