# [seqfan] Central Differences of Permutations, formula?

Ron Hardin rhhardin at att.net
Tue Sep 21 20:28:05 CEST 2010

```How many permutations p() of 1..N have K negative central differences
p(i+1)-p(i-1)

A bc program for the answer is below (via A000892)

Maybe there's a formula that's simple via some symbolic manipulation package?

2,3,3,6,12,6,10,50,50,10,20,160,360,160,20,35,525,1960,1960,525,35,70,
1540,10010,17080,10010,1540,70,126,4662,45738,130914,130914,45738,4662,
126,252,13104,203616,877968,1438920,877968,203616,13104,252,462,38346
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
Table starts
...2......3........6........10..........20............35.............70
...3.....12.......50.......160.........525..........1540...........4662
...6.....50......360......1960.......10010.........45738.........203616
..10....160.....1960.....17080......130914........877968........5517204
..20....525....10010....130914.....1438920......13547688......116189304
..35...1540....45738....877968....13547688.....174550992.....1997701992
..70...4662...203616...5517204...116189304....1997701992....29868078240
.126..13104...854700..32369568...917857512...20732684544...398942612640
.252..38346..3560172.183346020..6866412696..200430861345..4892905415970
.462.105336.14299428.997586304.48911180175.1825340594220.55931879316170
/* bc , formula r(n,k) from A000892 */
define factorial(n) {
auto prod;
prod=1;
while(n>=2)prod*=n--;
return prod;
}

define binomial(n,i) {
if(i<0||i>n)return 0;
return factorial(n)/(factorial(i)*factorial(n-i));
}

define r(n,k) {
auto j,sum;
sum=0;
for(j=0; j<=k+1; j++) {
sum+=(-1)^j*(k+1-j)^n*binomial(n+1,j);
}
return sum;
}

define t(n,k) {
auto sum,i;
sum=0;
for(i=0; i<=(k-1); i++)sum+=r((n+k)/2,i)*r((n+k)-(n+k)/2,(k-1)-i);
return sum*binomial((n+k),(n+k)/2);
}

for(index=1; index<=10000; index++) {
n=n+1; k=k-1; if(k<=0) { k=n; n=1; }
print index, " ", t(n,k), "\n";
}
quit

Table of n, a(n) for n=1..10000

rhhardin at mindspring.com
rhhardin at att.net (either)

```