ipermutations function

Permutations iterator