A336516
Sum of parts, counted without multiplicity, in all compositions of n.
Original entry on oeis.org
0, 1, 3, 10, 24, 59, 136, 309, 682, 1493, 3223, 6904, 14675, 31013, 65202, 136512, 284748, 592082, 1227709, 2539516, 5241640, 10798133, 22206568, 45597489, 93495667, 191464970, 391636718, 800233551, 1633530732, 3331568080, 6789078236, 13824212219, 28129459098
Offset: 0
a(4) = 1 + 1 + 2 + 1 + 2 + 1 + 2 + 2 + 1 + 3 + 3 + 1 + 4 = 24: (1)111, (1)1(2), (1)(2)1, (2)(1)1, (2)2, (1)(3), (3)(1), (4).
-
b:= proc(n, i, p) option remember; `if`(n=0, [p!, 0],
`if`(i<1, 0, add((p-> [0, `if`(j=0, 0, p[1]*i)]+p)(
b(n-i*j, i-1, p+j)/j!), j=0..n/i)))
end:
a:= n-> b(n$2, 0)[2]:
seq(a(n), n=0..38);
-
b[n_, i_, p_] := b[n, i, p] = If[n == 0, {p!, 0},
If[i < 1, {0, 0}, Sum[Function[{0, If[j == 0, 0, #[[1]]*i]} + #][
b[n - i*j, i - 1, p + j]/j!], {j, 0, n/i}]]];
a[n_] := b[n, n, 0][[2]];
Table[a[n], {n, 0, 38}] (* Jean-François Alcover, Mar 11 2022, after Alois P. Heinz *)
A309561
Total sum of prime parts in all compositions of n.
Original entry on oeis.org
0, 0, 2, 7, 16, 44, 102, 244, 554, 1247, 2772, 6111, 13334, 28916, 62302, 133557, 285020, 605869, 1283362, 2710008, 5706546, 11986171, 25118500, 52529339, 109643310, 228455907, 475250388, 987177924, 2047710144, 4242128909, 8777675002, 18142184432, 37458037658
Offset: 0
a(4) = 16: 1111, (2)11, 1(2)1, 11(2), (2)(2), (3)1, 1(3), 4.
-
a:= proc(n) option remember; add(a(n-j) +j*
`if`(isprime(j), ceil(2^(n-j-1)), 0), j=1..n)
end:
seq(a(n), n=0..33);
-
a[n_] := a[n] = Sum[a[n-j]+j*If[PrimeQ[j], Ceiling[2^(n-j-1)], 0], {j, 1, n}];
a /@ Range[0, 33] (* Jean-François Alcover, Jan 03 2021, after Alois P. Heinz *)
A336632
Number of prime parts, counted without multiplicity, in all compositions of n.
Original entry on oeis.org
0, 0, 1, 3, 6, 15, 33, 74, 160, 344, 731, 1544, 3237, 6753, 14022, 29009, 59819, 123010, 252341, 516560, 1055476, 2153115, 4385889, 8922556, 18131000, 36805009, 74643126, 151255021, 306267833, 619719217, 1253191291, 2532750315, 5116124712, 10329574480
Offset: 0
a(4) = 0 + 1 + 1 + 1 + 1 + 1 + 1 + 0 = 6: 1111, 11(2), 1(2)1, (2)11, (2)2, 1(3), (3)1, 4.
-
b:= proc(n, i, p) option remember; `if`(n=0, [p!, 0],
`if`(i<1, 0, add((h-> [0, `if`(j>0 and isprime(i),
h[1], 0)]+h)(b(n-i*j, i-1, p+j)/j!), j=0..n/i)))
end:
a:= n-> b(n$2, 0)[2]:
seq(a(n), n=0..38);
-
b[n_, i_, p_] := b[n, i, p] = If[n == 0, {p!, 0},
If[i < 1, 0, Sum[Function[h, {0, If[j > 0 && PrimeQ[i],
h[[1]], 0]} + h][b[n - i*j, i - 1, p + j]/j!], {j, 0, n/i}]]];
a[n_] := b[n, n, 0][[2]];
Table[a[n], {n, 0, 38}] (* Jean-François Alcover, May 30 2022, after Alois P. Heinz *)
Showing 1-3 of 3 results.