A336770 Total sum of the left-to-right minima in all compositions of n into distinct parts.
0, 1, 2, 7, 9, 18, 39, 54, 83, 133, 268, 337, 542, 754, 1148, 2058, 2689, 3909, 5607, 7945, 10965, 19024, 23838, 34840, 47332, 67121, 89006, 125571, 194513, 250634, 349001, 473018, 644107, 860595, 1164018, 1532321, 2327654, 2923772, 4022746, 5290310, 7188111
Offset: 0
Keywords
Examples
a(6) = 39 = 1+1+3+3+4+6+2+6+1+6+6: (1)23, (1)32, (2)(1)3, (2)3(1), (3)(1)2, (3)(2)(1), (2)4, (4)(2), (1)5, (5)(1), (6).
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
Programs
-
Maple
b:= proc(n, i, k) option remember; `if`(i
(2*i-k+1)*k/2, 0, `if`(n=0, [1, 0], b(n, i-1, k)+ (p-> p+[0, p[1]*i/k])(b(n-i, min(n-i, i-1), k-1)))) end: a:= n-> add(b(n$2, k)[2]*k!, k=1..floor((sqrt(8*n+1)-1)/2)): seq(a(n), n=0..40); -
Mathematica
b[n_, i_, k_] := b[n, i, k] = If[i < k || n > (2i - k + 1) k/2, {0, 0}, If[n == 0, {1, 0}, b[n, i - 1, k] + Function[p, p + {0, p[[1]] i/k}][b[n - i, Min[n - i, i - 1], k - 1]]]]; a[n_] := Sum[b[n, n, k][[2]] k!, {k, 1, Floor[(Sqrt[8n + 1] - 1)/2]}]; Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jul 12 2021, after Alois P. Heinz *)