3 ms·
I've wondered about the same thing of generating a permutation with a minimum number of samples. I'm not sure how Gray codes helps you here, and the multiplicat
by 6keZbCECT2uB 4y ago
I've wondered about the same thing of generating a permutation with a minimum number of samples. I'm not sure how Gray codes helps you here, and the multiplication sounds wrong since many outputs aren't reachable from any input.
- seanhunter 4y agoThe 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!