login
Number of permutations p() of 1..n+5 with centered difference p(i+1)-p(i-1) < 0 exactly 4 times
1

%I #3 Mar 31 2012 12:35:48

%S 20,525,10010,130914,1438920,13547688,116189304,917857512,6866412696,

%T 48911180175,336896355510,2249124467590,14697484687600,94059343340820,

%U 593714385206800,3693679623479664,22778493196278456,139016435228687562

%N Number of permutations p() of 1..n+5 with centered difference p(i+1)-p(i-1) < 0 exactly 4 times

%C Column 5 of A180887

%H R. H. Hardin, <a href="/A180882/b180882.txt">Table of n, a(n) for n=1..100</a>

%o /* bc , formula r(n,k) from A000892 */

%o define factorial(n) {

%o auto prod;

%o prod=1;

%o while(n>=2)prod*=n--;

%o return prod;

%o }

%o define binomial(n,i) {

%o if(i<0||i>n)return 0;

%o return factorial(n)/(factorial(i)*factorial(n-i));

%o }

%o define r(n,k) {

%o auto j,sum;

%o sum=0;

%o for(j=0; j<=k+1; j++) {

%o sum+=(-1)^j*(k+1-j)^n*binomial(n+1,j);

%o }

%o return sum;

%o }

%o define t(n,k) {

%o auto sum,i;

%o sum=0;

%o for(i=0; i<=(k-1); i++)sum+=r((n+k)/2,i)*r((n+k)-(n+k)/2,(k-1)-i);

%o return sum*binomial((n+k),(n+k)/2);

%o }

%o for(n=1; n<=100; n++) {

%o print n, " ", t(n,5), "\n";

%o }

%o quit

%K nonn

%O 1,1

%A _R. H. Hardin_ Sep 23 2010