permutations function complete