cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A306428 Decimal representation of permutations of lengths 1, 2, 3, ...

Original entry on oeis.org

1, 21, 312, 132, 231, 321, 4123, 1423, 2413, 4213, 1243, 2143, 3412, 4312, 1342, 3142, 4132, 1432, 2341, 3241, 4231, 2431, 3421, 4321, 51234, 15234, 25134, 52134, 12534, 21534, 35124, 53124, 13524, 31524, 51324, 15324, 23514, 32514, 52314, 25314, 35214, 53214, 12354, 21354, 31254
Offset: 0

Views

Author

Keywords

Comments

One way to generate the permutations is by using the factorial base (not to be confused with the Lehmer code).
Here is a detailed example showing how to compute a(2982).
We have i = 2982 = (4, 0, 4, 1, 0, 0, 0) in the factorial base.
So the initial vector "0" is (1, 2, 3, 4, 5, 6, 7), using seven active digits.
The factorial base vector is reversed, giving (0, 0, 0, 1, 4, 0, 4).
The instructions are to read from the factorial base vector, producing rotations to the right by as many steps as the column says, in the following order:
Start on the right; on the vector "0", a rotation of 4 units is made
(0, 0, 0, 1, 4, 0, [4])
(1, 2, 3, 4, 5, 6, 7)
The result is:
(4, 5, 6, 7, 1, 2, 3)
The 3 is retained, one column is advanced.
Next a rotation of 0 units is made (the null rotation)
(0, 0, 0, 1, 4, [0], 4)
(4, 5, 6, 7, 1, 2, 3)
The result is:
(4, 5, 6, 7, 1, 2, 3)
The 2 is retained, one column is advanced.
Now a rotation of 4 units is made
(0, 0, 0, 1, [4], 0, 4)
(4, 5, 6, 7, 1, 2, 3)
The result is:
(5, 6, 7, 1, 4, 2, 3)
The 4 is retained, one column is advanced.
Now a rotation of 1 units is made
(0, 0, 0, [1], 4, 0, 4)
(5, 6, 7, 1, 4, 2, 3)
The result is:
(1, 5, 6, 7, 4, 2, 3)
The 7 is retained, one column is advanced.
Now 3 null rotations are made.
All remaining values are retained: 6, 5, and 1
Thus 2982 represents the permutation: (1, 5, 6, 7, 4, 2, 3)
Or a(2982) = 1567423.

Examples

			The sequence may be regarded as a triangle, where each row consists of permutations of N terms; i.e., we have
1/,2,1/,3,1,2;1,3,2;2,3,1;3,2,1/4,1,2,3;1,4,2,3;2,4,1,3;...
Append to each an infinite number of fixed terms and we get a list of rearrangements of the natural numbers, but with only a finite number of terms permuted:
1/2,3,4,5,6,7,8,9,...
2,1/3,4,5,6,7,8,9,...
3,1,2/4,5,6,7,8,9,...
1,3,2/4,5,6,7,8,9,...
2,3,1/4,5,6,7,8,9,...
3,2,1/4,5,6,7,8,9,...
4,1,2,3/5,6,7,8,9,...
1,4,2,3/5,6,7,8,9,...
2,4,1,3/5,6,7,8,9,...
Alternatively, if we take only the first n terms of each such infinite row, then the first n! rows give all permutations of the elements 0,1,2,...,n-1.