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!)
A098281 Back-to-front insertion-permutation sequence. 3

%I #16 Sep 02 2021 13:44:38

%S 1,1,2,2,1,1,2,3,1,3,2,3,1,2,2,1,3,2,3,1,3,2,1,1,2,3,4,1,2,4,3,1,4,2,

%T 3,4,1,2,3,1,3,2,4,1,3,4,2,1,4,3,2,4,1,3,2,3,1,2,4,3,1,4,2,3,4,1,2,4,

%U 3,1,2,2,1,3,4,2,1,4,3,2,4,1,3,4,2,1,3,2,3,1,4,2,3,4,1,2,4,3,1,4,2,3,1,3,2,1,4,3,2,4,1,3,4,2,1,4,3,2,1

%N Back-to-front insertion-permutation sequence.

%C Contains every finite sequence of distinct numbers infinitely many times.

%F Write 1. Then place 2 after 1 and then 2 before 1, yielding 12 and 21, as well as the first 5 terms of the sequence. Next, generate the 6 permutations of 1, 2, 3 by inserting 3 into 12 and then 21, from back-to-front, like this: 123, 132, 312 then 213, 231, 321. Next, generate the 24 permutations of 1, 2, 3, 4 by inserting 4 into the permutations of 1, 2, 3. Continue forever.

%e The permutations can be written as

%e 1,

%e 12, 21,

%e 123, 132, 312, 213, 231, 321, etc.

%e Write them in order and insert commas.

%t perms[n_] := perms[n] = If[n == 1, {{1}}, Flatten[Table[Insert[#, n, pos], {pos, -1, -n, -1}]& /@ perms[n-1], 1]];

%t Table[perms[n], {n, 1, 4}] // Flatten (* _Jean-François Alcover_, Sep 02 2021 *)

%o (PARI) tabf(nn) = my(v=[[1]], w); print(v); for(n=2, nn, w=List([]); for(k=1, #v, for(i=1, n, listput(w, concat([v[k][1..n-i], n, v[k][n-i+1..n-1]])))); print(Vec(v=w))); \\ _Jinyuan Wang_, Aug 31 2021

%Y Cf. A030298, A098280.

%K nonn,tabf

%O 1,3

%A _Clark Kimberling_, Sep 01 2004

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 24 10:11 EDT 2024. Contains 371935 sequences. (Running on oeis4.)