Code for generating permutations and combinations