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!)
A137782 a(n) = the number of permutations (p(1), p(2), ..., p(n)) of (1,2,...,n) where, for each k (2 <= k <= n), the sign of (p(k) - p(k-1)) equals the sign of (p(n+2-k) - p(n+1-k)). 3

%I #29 May 13 2019 08:55:36

%S 1,1,2,2,12,24,200,540,6160,21616,306432,1310880,22338624,113017696,

%T 2245983168,13108918368,297761967360,1969736890624,50332737128960,

%U 372125016868608,10565549532009472,86337114225206784,2696451226217269248,24132714802787013632

%N a(n) = the number of permutations (p(1), p(2), ..., p(n)) of (1,2,...,n) where, for each k (2 <= k <= n), the sign of (p(k) - p(k-1)) equals the sign of (p(n+2-k) - p(n+1-k)).

%C Number of order n permutations whose descent set is invariant w.r.t. the function f(x) = n-x. - _Max Alekseyev_, May 06 2009

%H Alois P. Heinz, <a href="/A137782/b137782.txt">Table of n, a(n) for n = 0..190</a>

%F a(2n) = A000984(n)*A060350(n). - _Max Alekseyev_, Apr 23 2009

%e Consider the permutation (for n = 7): 3,6,7,5,1,2,4.

%e The signs of the differences between adjacent terms form the sequence: ++--++, which has reflective symmetry. So this permutation, among others, is counted when n = 7.

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

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

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

%p end:

%p a:= proc(n) option remember; local r;

%p `if`(irem(n, 2, 'r')=0, b(0, r$2)*binomial(n, r),

%p add(add(binomial(j-1, i)*binomial(n-j, r-i)*

%p b(r-i, i, n-j-r+i), i=0..min(j-1, r)), j=1..n))

%p end:

%p seq(a(n), n=0..30); # _Alois P. Heinz_, Sep 15 2015

%t b[u_, o_, h_] := b[u, o, h] = If[u+o == 0, 1, Sum[Sum[b[u-j, o+j-1, h+i-1], {i, 1, u+o-h}], {j, 1, u}] + Sum[Sum[b[u+j-1, o-j, h-i], {i, 1, h}], {j, 1, o}]];

%t a[n_] := a[n] = Module[{r = Quotient[n, 2]}, If[Mod[n, 2] == 0, b[0, r, r]*Binomial[n, r], Sum[Sum[Binomial[j-1, i]*Binomial[n-j, r-i]*b[r-i, i, n-j-r+i], {i, 0, Min[j-1, r]}], {j, 1, n}]]];

%t Table[a[n], {n, 0, 30}] (* _Jean-François Alcover_, May 13 2019, after _Alois P. Heinz_ *)

%o (PARI) { a(n) = local(r,u,c,t); r=0; forvec(v=vector(n-1,i,[2*i==n,1]), u=sum(i=1,#v,v[i]); c=sum(i=1,(n-1)\2,!v[i]&&!v[n-i]); t=[0]; for(i=1,#v,if(v[i],t=concat(t,[i]))); r += (-1)^u * 2^c * n! \ prod(i=2,#t,(t[i]-t[i-1])!) \ (n-t[ #t])! ); (-1)^(n+1)*r } \\ _Max Alekseyev_, May 06 2009

%Y Cf. A137783.

%K nonn

%O 0,3

%A _Leroy Quet_, Feb 10 2008

%E First 8 terms calculated by _Olivier Gérard_

%E Extended by _Max Alekseyev_, May 06 2009

%E a(0), a(22) from _Alois P. Heinz_, Jul 02 2015

%E a(23) from _Alois P. Heinz_, Sep 15 2015

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 02:23 EDT 2024. Contains 371906 sequences. (Running on oeis4.)