A268532 Decimal representation of permutations of lengths 1, 2, 3, ... arranged first by number of inversions and then lexicographically.
1, 12, 21, 123, 132, 213, 231, 312, 321, 1234, 1243, 1324, 2134, 1342, 1423, 2143, 2314, 3124, 1432, 2341, 2413, 3142, 3214, 4123, 2431, 3241, 3412, 4132, 4213, 3421, 4231, 4312, 4321, 12345, 12354, 12435, 13245, 21345, 12453
Offset: 1
Examples
The 24 permutations of length 4 and their numbers of inversions: 1234 0 1243 1 1324 1 2134 1 1342 2 1423 2 2143 2 2314 2 3124 2 1432 3 2341 3 2413 3 3142 3 3214 3 4123 3 2431 4 3241 4 3412 4 4132 4 4213 4 3421 5 4231 5 4312 5 4321 6
Links
- David Consiglio, Jr., Table of n, a(n) for n = 1..5913
- David Consiglio, Jr., Python Program