Ehrlich Permutations algorithm working