login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A097825 Triangle of permutations of [1,2,3,...,m] made by alternatively swapping left and right terms. (See comment.) 2
1, 2, 1, 2, 3, 1, 3, 1, 2, 4, 2, 1, 5, 4, 3, 1, 3, 2, 5, 6, 4, 6, 1, 2, 3, 5, 4, 7, 1, 7, 4, 5, 6, 8, 3, 2, 9, 7, 6, 1, 4, 5, 3, 2, 8, 7, 10, 8, 3, 6, 9, 5, 4, 1, 2, 5, 11, 10, 7, 6, 3, 8, 9, 1, 2, 4, 11, 10, 12, 1, 4, 5, 9, 6, 3, 2, 7, 8, 3, 6, 7, 11, 10, 5, 4, 9, 12, 13, 1, 8, 2, 14, 6, 7, 1, 2, 3, 13, 10 (list; table; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Start with [1,2,3,...,m]. Reverse the order of the leftmost 1 element. (trivial) Reverse the order of the rightmost 2 elements. Reverse the order of the leftmost 3 elements of the previous permutation. Reverse the order of the rightmost 4 elements of the previous permutation. ...until... Reverse the order of the rightmost m elements of the (m-1)th permutation if m is even. Or reverse the order of the leftmost m elements of the (m-1)th permutation if m is odd. (Of course, these options are the same thing, reversing the order of the entire permutation.)

LINKS

Table of n, a(n) for n=1..99.

EXAMPLE

[1,2,3,4,5,6]->[1,2,3,4,5,6]->[1,2,3,4,6,5]->[3,2,1,4,6,5]->[3,2,5,6,4,1]->[4,6,5,2,3,1]->[1,3,2,5,6,4].

Triangle begins:

1,

2, 1,

2, 3, 1,

3, 1, 2, 4,

2, 1, 5, 4, 3,

1, 3, 2, 5, 6, 4,

...

MAPLE

p:=proc(n) local B, k, u, rev, w; with(linalg): u:=n->[seq(i, i=1..n)]; rev:=proc(a) [seq(a[nops(a)+1-i], i=1..nops(a))] end; w:=(m, n)->[seq(i, i=m..n)]; B[0]:=matrix(1, n, u(n)): if n mod 2 = 0 then for k from 1 to n/2 do B[2*k-1]:=concat(submatrix(B[2*k-2], [1], rev(u(2*k-1))), submatrix(B[2*k-2], [1], w(2*k, n))): B[2*k]:=concat(submatrix(B[2*k-1], [1], u(n-2*k)), submatrix(B[2*k-1], [1], rev(w(n+1-2*k, n)))) od else for k from 1 to (n-1)/2 do B[2*k-1]:=concat(submatrix(B[2*k-2], [1], rev(u(2*k-1))), submatrix(B[2*k-2], [1], w(2*k, n))): B[2*k]:=concat(submatrix(B[2*k-1], [1], u(n-2*k)), submatrix(B[2*k-1], [1], rev(w(n+1-2*k, n)))) od: B[n]:=concat(submatrix(B[n-1], [1], rev(u(n))), submatrix(B[n-1], [1], [])) fi end: for n from 1 to 12 do p(n) od; # supplies the sequence in triangular form # Emeric Deutsch, Nov 17 2004

CROSSREFS

Sequence in context: A101161 A245049 A214261 * A002343 A082076 A231516

Adjacent sequences:  A097822 A097823 A097824 * A097826 A097827 A097828

KEYWORD

easy,nonn,tabl

AUTHOR

Leroy Quet, Aug 26 2004

EXTENSIONS

More terms from Emeric Deutsch, Nov 17 2004

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified September 21 17:46 EDT 2019. Contains 327273 sequences. (Running on oeis4.)