This does print ALL the permutations of a set size, so you should not go above about 6.

- This program returns a list of all the permutations of the set {1, 2, ..., n}.


The source.