Full threadzamalek·Another option is to use a factoradic[1]. The advantage with a factoradic is that you can index directly to any permutation without having to find its predecessor first.[1]: http://en.wikipedia.org/wiki/Factorial_number_systemView on HN