login
Array read by antidiagonals: T(n,k)=number of permutations p() of 1..n+k with centered difference p(i+1)-p(i-1) < 0 exactly k-1 times
9

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

%S 2,3,3,6,12,6,10,50,50,10,20,160,360,160,20,35,525,1960,1960,525,35,

%T 70,1540,10010,17080,10010,1540,70,126,4662,45738,130914,130914,45738,

%U 4662,126,252,13104,203616,877968,1438920,877968,203616,13104,252,462,38346

%N Array read by antidiagonals: T(n,k)=number of permutations p() of 1..n+k with centered difference p(i+1)-p(i-1) < 0 exactly k-1 times

%C Table starts

%C ...2......3........6........10..........20............35.............70

%C ...3.....12.......50.......160.........525..........1540...........4662

%C ...6.....50......360......1960.......10010.........45738.........203616

%C ..10....160.....1960.....17080......130914........877968........5517204

%C ..20....525....10010....130914.....1438920......13547688......116189304

%C ..35...1540....45738....877968....13547688.....174550992.....1997701992

%C ..70...4662...203616...5517204...116189304....1997701992....29868078240

%C .126..13104...854700..32369568...917857512...20732684544...398942612640

%C .252..38346..3560172.183346020..6866412696..200430861345..4892905415970

%C .462.105336.14299428.997586304.48911180175.1825340594220.55931879316170

%H R. H. Hardin, <a href="/A180887/b180887.txt">Table of n, a(n) for n=1..10000</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(index=1; index<=10000; index++) {

%o n=n+1; k=k-1; if(k<=0) { k=n; n=1; }

%o print index, " ", t(n,k), "\n";

%o }

%o quit

%K nonn,tabl

%O 1,1

%A _R. H. Hardin_ Sep 23 2010