OFFSET
2,2
FORMULA
a(p,n)=n(n-1)(p-1)p^{n-1}/4.
EXAMPLE
a(2,3)=6 because the words 010, 100, 101, 110 have 1, 2, 1, 2 inversions, respectively, while 000, 001, 011 and 111 have none.
a(3,2)=3 because each of the words 10, 20, 21 has 1 inversion, while 00, 01, 02, 11, 12, 22 have none.
Square array starts:
1,6,24,80,240, ...;
3,27,162,810,3645, ... ;
6,72,576, 3840,23040, ... ;
10,150,1500,12500, 93750,...;
MAPLE
a := proc (p, n) options operator, arrow: (1/4)*n*(n-1)*(p-1)*p^(n-1) end proc: for p from 2 to 8 do seq(a(p, n), n = 2 .. 8) end do; # yields the first seven rows and seven columns of the square array
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Emeric Deutsch, Oct 31 2010
STATUS
approved