login
Number of permutations p() of 1..n+2 with centered difference p(i+1)-p(i-1) < 0 exactly once
1

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

%S 3,12,50,160,525,1540,4662,13104,38346,105336,303732,823680,2361645,

%T 6357780,18208190,48814480,139952670,374315656,1075431084,2872519104,

%U 8273365282,22082137896,63760878300,170112213600,492371090100

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

%C Column 2 of A180887

%H R. H. Hardin, <a href="/A180879/b180879.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,2), "\n";

%o }

%o quit

%K nonn

%O 1,1

%A _R. H. Hardin_ Sep 23 2010