OFFSET
0,6
LINKS
Alois P. Heinz and Vaclav Kotesovec, Table of n, a(n) for n = 0..8950 (terms 0..5000 from Alois P. Heinz)
Wikipedia, Inversion (discrete mathematics)
EXAMPLE
a(3) = 1: 21.
a(4) = 1: 31.
a(5) = 2: 32, 41.
a(6) = 5: 42, 51, 321 (three inversions).
MAPLE
b:= proc(n, i, t) option remember; `if`(n>i*(i+1)/2, 0,
`if`(n=0, [1, 0], b(n, i-1, t)+`if`(i>n, 0,
(p-> p+[0, p[1]*t])(b(n-i, i-1, t+1)))))
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 > i*(i+1)/2, 0, If[n == 0, {1, 0}, b[n, i-1, t] + If[i>n, 0, Function[p, p+{0, p[[1]]*t}][b[n-i, i-1, t+1]]]]]; a[n_] := b[n, n, 0][[2]]; Table[a[n], {n, 0, 60}] (* Jean-François Alcover, Feb 05 2017, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 05 2016
STATUS
approved