OFFSET
1,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
FORMULA
G.f.: sum(x^p(j)/(1-x^p(j)),j=1..infinity)/product(1-x^p(j), j=1..infinity), where p(j) is the j-th prime. - Emeric Deutsch, Mar 07 2006
EXAMPLE
Partitions of 9 into primes are 2+2+2+3=3+3+3=2+2+5=2+7; thus a(9)=4+3+3+2=12.
MAPLE
g:=sum(x^ithprime(j)/(1-x^ithprime(j)), j=1..20)/product(1-x^ithprime(j), j=1..20): gser:=series(g, x=0, 60): seq(coeff(gser, x^n), n=1..57); # Emeric Deutsch, Mar 07 2006
# second Maple program:
with(numtheory):
b:= proc(n, i) option remember; local g;
if n=0 then [1, 0]
elif i<1 then [0, 0]
elif i=1 then `if`(irem(n, 2)=0, [1, n/2], [0, 0])
else g:= `if`(ithprime(i)>n, [0$2], b(n-ithprime(i), i));
b(n, i-1) +g +[0, g[1]]
fi
end:
a:= n-> b(n, pi(n))[2]:
seq(a(n), n=1..60); # Alois P. Heinz, Oct 30 2012
MATHEMATICA
nn=40; a=Product[1/(1-y x^i), {i, Table[Prime[n], {n, 1, nn}]}]; Drop[CoefficientList[Series[D[a, y]/.y->1, {x, 0, nn}], x], 1] (* Geoffrey Critzer, Oct 30 2012 *)
b[n_, i_] := b[n, i] = Module[{g}, Which[n == 0, {1, 0}, i < 1, {0, 0}, i == 1, If[EvenQ[n], {1, n/2}, {0, 0}], True, g = If[Prime[i] > n, {0, 0}, b[n - Prime[i], i]]; b[n, i - 1] + g + {0, g[[1]]}]];
a[n_] := b[n, PrimePi[n]][[2]];
Array[a, 52] (* Jean-François Alcover, Dec 30 2017, after Alois P. Heinz *)
Table[Length[Flatten[Select[IntegerPartitions[n], AllTrue[#, PrimeQ]&]]], {n, 60}] (* Harvey P. Dale, Jul 11 2023 *)
PROG
(PARI)
sumparts(n, pred)={sum(k=1, n, 1/(1-pred(k)*x^k) - 1 + O(x*x^n))/prod(k=1, n, 1-pred(k)*x^k + O(x*x^n))}
{my(n=60); Vec(sumparts(n, isprime), -n)} \\ Andrew Howroyd, Dec 28 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladeta Jovovic, Jul 17 2003
STATUS
approved