login
Total sum of the left-to-right maxima in all compositions of n into distinct parts.
4

%I #13 Jul 12 2021 13:48:54

%S 0,1,2,8,11,22,53,75,123,193,418,538,894,1268,1950,3567,4799,7143,

%T 10355,14968,20701,36398,46420,69071,94972,136385,182522,259104,

%U 402405,527090,741569,1015491,1397661,1880541,2567202,3392612,5153156,6553844,9088372,12040797

%N Total sum of the left-to-right maxima in all compositions of n into distinct parts.

%H Alois P. Heinz, <a href="/A336771/b336771.txt">Table of n, a(n) for n = 0..1000</a>

%e a(6) = 53 = 6+4+5+5+3+3+6+4+6+5+6: (1)(2)(3), (1)(3)2, (2)1(3), (2)(3)1, (3)12, (3)21, (2)(4), (4)2, (1)(5), (5)1, (6).

%p b:= proc(n, i, k, m) option remember; `if`(i<k or n>

%p (2*i-k+1)*k/2, 0, `if`(n=0, [1, 0], b(n, i-1, k, m)+

%p (p-> p+[0, p[1]*i/(m+1-k)])(b(n-i, min(n-i, i-1), k-1, m))))

%p end:

%p a:= n-> add(b(n$2, k$2)[2]*k!, k=1..floor((sqrt(8*n+1)-1)/2)):

%p seq(a(n), n=0..40);

%t b[n_, i_, k_, m_] := b[n, i, k, m] = If[i < k || n >

%t (2*i - k + 1)*k/2, {0, 0}, If[n == 0, {1, 0}, b[n, i - 1, k, m] +

%t Function[p, p+{0, p[[1]]*i/(m+1-k)}][b[n-i, Min[n-i, i-1], k-1, m]]]];

%t a[n_] := Sum[b[n, n, k, k][[2]]*k!, {k, 1, Floor[(Sqrt[8*n + 1] - 1)/2]}];

%t Table[a[n], {n, 0, 40}] (* _Jean-François Alcover_, Jul 12 2021, after _Alois P. Heinz_ *)

%Y Cf. A000009, A000254, A003056, A032020, A336511, A336718, A336770.

%K nonn

%O 0,3

%A _Alois P. Heinz_, Aug 04 2020