%I #30 Jun 12 2015 10:24:49
%S 1,0,0,2,8,0,0,576,4608,0,0,2505600,30067200,0,0,53444966400,
%T 855119462400,0,0,3587014803456000,71740296069120000,0,0,
%U 584198928937451520000,14020774294498836480000,0,0,196340349691596912721920000,5497529791364713556213760000,0,0
%N Number of permutations p of (1,2,3,...,n) such that 1*(-1)^p(1)+2*(-1)^p(2)+3*(-1)^p(3)+...+n*(-1)^p(n)=0.
%C Equivalently the number of grand Dyck n-paths in which each run length is selected from {1..2*n} without replacement. - _David Scambler_, Apr 16 2013
%H Alois P. Heinz, <a href="/A073410/b073410.txt">Table of n, a(n) for n = 0..200</a>
%F It seems that a(n)=0 if n==1 or 2 (mod 4) and a(4*k)=4*k*a(4*k-1). - _Benoit Cloitre_, Aug 23 2002
%p b:= proc(n, i, c) option remember; `if`(abs(n)>i*(i+1)/2, 0,
%p `if`(i=0, `if`(abs(c)<2, 1, 0),
%p b(n+i, i-1, c+1) +b(n-i, i-1, c-1)))
%p end:
%p a:= n-> b(0, n, 0)*floor(n/2)!*ceil(n/2)!/2^irem(n, 2):
%p seq(a(n), n=0..40); # _Alois P. Heinz_, Apr 29 2015
%t b[n_, i_, c_] := b[n, i, c] = If[Abs[n] > i*(i+1)/2, 0, If[i == 0, If[Abs[c]<2, 1, 0], b[n+i, i-1, c+1] + b[n-i, i-1, c-1]]]; a[n_] := b[0, n, 0]*Floor[n/2]! *Ceiling[n/2]!/2^Mod[n, 2]; Table[a[n], {n, 0, 40}] (* _Jean-François Alcover_, Jun 12 2015, after _Alois P. Heinz_ *)
%o (PARI) a(n)=sum(k=1,n!,if(sum(i=1,n,i*(-1)^component(numtoperm(n,k),i)),0,1))
%Y Cf. A227850.
%K nonn
%O 0,4
%A _Benoit Cloitre_, Aug 23 2002
%E More terms from _John W. Layman_, Feb 05 2003
%E a(14)-a(22) from _Robert Gerbicz_, Nov 22 2010
%E a(0), a(23)-a(30) from _Alois P. Heinz_, Apr 28 2015