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!)
A162977 Number of fixed points in all reverse alternating (i.e., up-down) permutations of {1,2,...,n}. 3

%I #17 Jul 21 2017 10:54:15

%S 1,2,1,4,15,62,257,1384,7679,50522,346113,2702764,22022143,199360982,

%T 1881735169,19391512144,207983607807,2404879675442,28880901505025,

%U 370371188237524,4922617151619071,69348874393137902,1010501269355233281

%N Number of fixed points in all reverse alternating (i.e., up-down) permutations of {1,2,...,n}.

%C a(n) = Sum_{k>=0} k*A162980(n,k).

%C a(2n+1) = A162978(2n+1).

%H Alois P. Heinz, <a href="/A162977/b162977.txt">Table of n, a(n) for n = 1..485</a>

%H R. P. Stanley, <a href="http://math.mit.edu/~rstan/transparencies/ida.pdf">Alternating permutations</a>, Talk slides.

%F a(2n) = E(2n)-(-1)^n; a(2n+1) = Sum_{j=0..n}(-1)^j*E(2n+1-2j), where E(i) = A000111(i) are the Euler (or up-down) numbers.

%e a(4) = 4 because in the 5 (=A000111(4)) up-down permutations of {1,2,3,4}, namely 1423, 1324, 3412, 2413, and 2314, we have a total of 1+2+0+0+1=4 fixed points.

%p E := sec(x)+tan(x): Eser := series(E, x = 0, 30): for n from 0 to 27 do E[n] := factorial(n)*coeff(Eser, x, n) end do: for n to 12 do a[2*n] := E[2*n]-(-1)^n end do: for n from 0 to 12 do a[2*n+1] := add((-1)^j*E[2*n+1-2*j], j = 0 .. n) end do: seq(a[n], n = 1 .. 25);

%p # second Maple program:

%p b:= proc(u, o) option remember; `if`(u+o=0, 1,

%p add(b(o-1+j, u-j), j=1..u))

%p end:

%p a:= proc(n) option remember; `if`(irem(n, 2, 'r')=0,

%p b(n, 0)-(-1)^r, add((-1)^j*b(n-2*j, 0), j=0..r))

%p end:

%p seq(a(n), n=1..30); # _Alois P. Heinz_, Dec 09 2016

%t b[u_, o_] := b[u, o] = If[u + o == 0, 1, Sum[b[o - 1 + j, u - j], {j, 1, u}]]; a[n_] := a[n] = If[{q, r} = QuotientRemainder[n, 2]; r == 0, b[n, 0] - (-1)^q, Sum[(-1)^j*b[n - 2*j, 0], {j, 0, q}]]; Table[a[n], {n, 1, 30}] (* _Jean-François Alcover_, Dec 20 2016, after _Alois P. Heinz_ *)

%Y Cf. A000111, A162978, A162980.

%K nonn

%O 1,2

%A _Emeric Deutsch_, Aug 06 2009

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 August 14 05:24 EDT 2024. Contains 375146 sequences. (Running on oeis4.)