OFFSET
0,3
EXAMPLE
For n = 6 we have:
--------------------------------------
. Sum of
Partitions noncomposite
of 6 parts
--------------------------------------
6 .......................... 0
3 + 3 ...................... 6
4 + 2 ...................... 2
2 + 2 + 2 .................. 6
5 + 1 ...................... 6
3 + 2 + 1 .................. 6
4 + 1 + 1 .................. 2
2 + 2 + 1 + 1 .............. 6
3 + 1 + 1 + 1 .............. 6
2 + 1 + 1 + 1 + 1 .......... 6
1 + 1 + 1 + 1 + 1 + 1 ...... 6
------------------------------------
Total ..................... 52
So a(6) = 52.
MAPLE
b:= proc(n, i) option remember; `if`(n=0 or i=1, [1, n], b(n, i-1)+
(p-> p+[0, `if`(isprime(i), p[1]*i, 0)])(b(n-i, min(n-i, i))))
end:
a:= n-> b(n$2)[2]:
seq(a(n), n=0..50); # Alois P. Heinz, Aug 13 2019
MATHEMATICA
b[n_, i_] := b[n, i] = If[n==0 || i==1, {1, n}, b[n, i-1] + # + {0, If[PrimeQ[i], #[[1]] i, 0]}&[b[n-i, Min[n-i, i]]]];
a[n_] := b[n, n][[2]];
a /@ Range[0, 50] (* Jean-François Alcover, Nov 17 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Omar E. Pol, Aug 08 2019
STATUS
approved