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!)
A229551 Number of 1 up, 1 down, 2 up, 2 down, ... permutations of [n]. 5
1, 1, 1, 2, 5, 9, 40, 111, 643, 2261, 6176, 53560, 265001, 976535, 10699235, 65839306, 297528021, 1096638993, 16254932942, 131192702293, 760059358527, 3527632148650, 63700463354263, 620906514026512, 4309068955961383, 23776534616426566, 110660256825406666 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
EXAMPLE
a(2) = 1: 12.
a(3) = 2: 132, 231.
a(4) = 5: 1324, 1423, 2314, 2413, 3412.
a(5) = 9: 13245, 14235, 15234, 23145, 24135, 25134, 34125, 35124, 45123.
a(6) = 40: 132465, 132564, ..., 561342, 562341.
a(7) = 111: 1324765, 1325764, ..., 6724531, 6734521.
MAPLE
b:= proc(u, o, t, k) option remember; `if`(u+o=0, 1, `if`(t>0,
add(b(u+j-1, o-j, `if`(t=k, [-1, k], [t+1, k])[]), j=1..o),
add(b(u-j, o+j-1, `if`(t=-k, [1, k+1], [t-1, k])[]), j=1..u)))
end:
a:= n-> `if`(n=0, 1, add(b(j-1, n-j, 1, 1), j=1..n)):
seq(a(n), n=0..35);
MATHEMATICA
b[u_, o_, t_, k_] := b[u, o, t, k] = If[u + o == 0, 1, If[t > 0, Sum[b[u + j - 1, o - j, If[t == k, -1, t + 1], k], {j, 1, o}], Sum[b[u - j, o + j - 1, If[t == -k, 1, t - 1], If[t == -k, k + 1, k]], {j, 1, u}]]];
a[n_] := If[n == 0, 1, Sum[b[j - 1, n - j, 1, 1], {j, 1, n}]];
Table[a[n], {n, 0, 35}] (* Jean-François Alcover, Jun 16 2018, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A151952 A090291 A161137 * A247550 A249583 A109469
KEYWORD
nonn,eigen
AUTHOR
Alois P. Heinz, Oct 02 2013
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 July 1 05:41 EDT 2024. Contains 373911 sequences. (Running on oeis4.)