login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A121304
Number of parts in all the compositions of n into primes (i.e., in all ordered sequences of primes having sum n).
5
1, 1, 2, 5, 5, 14, 17, 32, 53, 76, 139, 198, 334, 515, 798, 1280, 1938, 3075, 4710, 7299, 11298, 17296, 26738, 40874, 62763, 96036, 146674, 224210, 341562, 520767, 792375, 1204951, 1831124, 2779234, 4217008, 6391663, 9683056, 14659038, 22177341
OFFSET
2,3
COMMENTS
a(n) = Sum_{k=1..floor(n/2)} k*A121303(n,k).
LINKS
FORMULA
G.f.: (Sum_{i>=1} z^prime(i))/(1 - Sum_{i>=1} z^prime(i))^2.
EXAMPLE
a(8) = 17 because the compositions of 8 into primes are [3,5], [5,3], [2,3,3], [3,2,3], [3,3,2] and [2,2,2,2], having a total of 2+2+3+3+3+4 = 17 parts.
MAPLE
g:=sum(z^ithprime(i), i=1..53)/(1-sum(z^ithprime(i), i=1..53))^2: gser:=series(g, z=0, 48): seq(coeff(gser, z, n), n=2..45);
# second Maple program:
b:= proc(n) option remember; `if`(n=0, [1, 0], add(
`if`(isprime(j), (p->p+[0, p[1]])(b(n-j)), 0), j=1..n))
end:
a:= n-> b(n)[2]:
seq(a(n), n=2..50); # Alois P. Heinz, Nov 08 2013, revised Feb 12 2021
MATHEMATICA
nn=40; a[x_]:=Sum[x^Prime[n], {n, 1, nn}]; Drop[CoefficientList[Series[D[1/(1-y a[x]), y]/.y ->1, {x, 0, nn}], x], 2] (* Geoffrey Critzer, Nov 08 2013 *)
Table[Length[Flatten[Union[Flatten[Permutations/@Select[ IntegerPartitions[ n], AllTrue[ #, PrimeQ]&], 1]]]], {n, 2, 40}] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Oct 24 2016 *)
b[n_] := b[n] = If[n == 0, {1, 0}, Sum[If[PrimeQ[j],
Function[p, p+{0, p[[1]]}][b[n-j]], {0, 0}], {j, 1, n}]];
a[n_] := b[n][[2]];
a /@ Range[2, 50] (* Jean-François Alcover, Jun 01 2021, after Alois P. Heinz *)
CROSSREFS
Sequence in context: A154696 A154698 A063786 * A002106 A232316 A184604
KEYWORD
nonn
AUTHOR
Emeric Deutsch, Aug 06 2006
STATUS
approved