OFFSET
0,5
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Wikipedia, Inversion (discrete mathematics)
Wikipedia, Partition (number theory)
FORMULA
a(n) = Sum_{k>0} k * A264033(n,k).
EXAMPLE
a(3) = 1: one inversion in 21.
a(4) = 3: one inversion in 31, and two inversions in 211.
MAPLE
b:= proc(n, i, t) option remember; `if`(n=0, [1, 0], `if`(i<1, 0,
add((p-> p+[0, p[1]*j*t])(b(n-i*j, i-1, t+j)), j=0..n/i)))
end:
a:= n-> b(n$2, 0)[2]:
seq(a(n), n=0..60);
MATHEMATICA
b[n_, i_, t_] := b[n, i, t] = If[n==0, {1, 0}, If[i<1, 0, Sum[Function[p, If[p === 0, 0, p+{0, p[[1]]*j*t}]][b[n-i*j, i-1, t+j]], {j, 0, n/i}]]];
a[n_] := b[n, n, 0][[2]]; Table[a[n], {n, 0, 60}] (* Jean-François Alcover, Feb 03 2017, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 05 2016
STATUS
approved