3 ms·
The idea is just a closed form solution that gets you from a number in 1...nPermutations to a single specific permutation. I was using Gray codes as an example
by seanhunter 4y ago
The idea is just a closed form solution that gets you from a number in 1...nPermutations to a single specific permutation. I was using Gray codes as an example of a sequence that exhausts all permutations with a closed form that gets you to a specific point in the sequence.
Might not work - as I say I never actually got around to implementing it.
- erikstrand 4y agoI think you're looking for a factorial number system [1] and/or Lehmer code [2]. [1] https://en.wikipedia.org/wiki/Factorial_number_system https://en.wikipedia.org/wiki/Factorial_number_system [2] https://en.wikipedia.org/wiki/Lehmer_code https://en.wikipedia.org/wiki/Lehmer_code
- seanhunter 4y agoThanks!