login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A306428 Decimal representation of permutations of lengths 1, 2, 3, ... 1
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
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.
LINKS
EXAMPLE
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.
PROG
' The following program is developed in Visual Basic, and works for N = 0 to N = 9.
' This restriction is imposed by the number of lines in Excel spreadsheets.
' In this example, N = 5.
' To modify N, you should only change the definition of Dim A(5) to Dim A(N), and
change the value in N = 5.
Option Explicit
Dim Fila As Double, N As Double
Dim A(5) As Double
Sub Factorial()
Dim J As Double, M As Double, O As Double, Y As Double, I As Double
Dim Z As Double, R As Double, V As Double, Aux As Double
Fila = 0
M = 1
N = 5
For J = 1 To N
A(J) = J
M = M * A(J)
Next J
For Fila = 0 To M - 1
V = M
Z = N
Do While Z > 1
V = V / Z
If Fila Mod V = 0 Then
R = Z
Z = 1
Else
Z = Z - 1
End If
Loop
Y = R \ 2
If Y > 0 Then
For Z = 1 To Y
Aux = A(Z)
A(Z) = A(R - Z + 1)
A(R - Z + 1) = Aux
Next Z
Call PrintData
End If
Next Fila
End Sub
Sub PrintData()
Dim I As Integer
For I = 1 To N
Range("A1:G5040").Cells(Fila + 1, I) = N + 1 - A(I)
Next I
End Sub
CROSSREFS
Sequence in context: A018054 A021484 A198376 * A317201 A281254 A157088
KEYWORD
nonn
AUTHOR
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 06:04 EDT 2024. Contains 371906 sequences. (Running on oeis4.)