OFFSET
0,19
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..10000 (terms 0..2000 from Alois P. Heinz)
FORMULA
G.f.: (1/2)*[Product_{k>=1} (1+z^prime(k)) - Product_{k>=1} (1-z^prime(k))].
a(n) = Sum_{k>=0} A219180(n,2*k+1). - Alois P. Heinz, Nov 15 2012
EXAMPLE
a(33) = 4 because we have [23,7,3], [19,11,3], [17,13,3], and [17,11,5].
MAPLE
g := 1/2*(Product(1+z^ithprime(k), k = 1 .. 120)-Product(1-z^ithprime(k), k = 1 .. 120)): gser := series(g, z = 0, 110): seq(coeff(gser, z, n), n = 0 .. 85);
# second Maple program
with(numtheory):
b:= proc(n, i) option remember;
`if`(n=0, [1], `if`(i<1, [], zip((x, y)->x+y, b(n, i-1),
[0, `if`(ithprime(i)>n, [], b(n-ithprime(i), i-1))[]], 0)))
end:
a:= proc(n) local l; l:= b(n, pi(n));
add(l[2*i], i=1..iquo(nops(l), 2))
end:
seq(a(n), n=0..100); # Alois P. Heinz, Nov 15 2012
MATHEMATICA
b[n_, i_] := b[n, i] = If[n == 0, {1}, If[i<1, {}, Plus @@ PadRight[{b[n, i-1], Join[{0}, If[Prime[i]>n, {}, b[n-Prime[i], i-1]]]}]]]; a[n_] := Module[{l}, l = b[n, PrimePi[n]]; Sum[l[[2*i]], {i, 1, Quotient[Length[l], 2]}]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Jan 30 2014, after Alois P. Heinz *)
PROG
(PARI)
parts(n, pred, y)={prod(k=1, n, 1 + if(pred(k), y*x^k + O(x*x^n), 0))}
{my(n=80); (Vec(parts(n, isprime, 1)) - Vec(parts(n, isprime, -1)))/2} \\ Andrew Howroyd, Dec 28 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Emeric Deutsch (suggested by R. J. Mathar), Jan 09 2011
STATUS
approved