login
Number of partitions of n into an odd number of distinct primes.
10

%I #33 Mar 31 2023 18:05:50

%S 0,0,1,1,0,1,0,1,0,0,1,1,1,1,1,1,1,1,2,2,2,2,2,3,2,2,3,3,3,4,3,5,3,4,

%T 4,5,5,6,6,7,5,7,7,8,8,8,9,11,9,10,11,12,12,14,13,16,14,16,15,19,17,

%U 20,20,22,20,23,24,27,26,28,27,33,30,34,34,37,36,41,40,46,43,47,46,55,50,56

%N Number of partitions of n into an odd number of distinct primes.

%H Seiichi Manyama, <a href="/A184172/b184172.txt">Table of n, a(n) for n = 0..10000</a> (terms 0..2000 from Alois P. Heinz)

%F G.f.: (1/2)*[Product_{k>=1} (1+z^prime(k)) - Product_{k>=1} (1-z^prime(k))].

%F a(n) = Sum_{k>=0} A219180(n,2*k+1). - _Alois P. Heinz_, Nov 15 2012

%F a(n) + A184171(n) = A000586(n). - _R. J. Mathar_, Mar 31 2023

%e a(33) = 4 because we have [23,7,3], [19,11,3], [17,13,3], and [17,11,5].

%p 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);

%p # second Maple program

%p with(numtheory):

%p b:= proc(n, i) option remember;

%p `if`(n=0, [1], `if`(i<1, [], zip((x, y)->x+y, b(n, i-1),

%p [0, `if`(ithprime(i)>n, [], b(n-ithprime(i), i-1))[]], 0)))

%p end:

%p a:= proc(n) local l; l:= b(n, pi(n));

%p add(l[2*i], i=1..iquo(nops(l), 2))

%p end:

%p seq(a(n), n=0..100); # _Alois P. Heinz_, Nov 15 2012

%t 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_ *)

%o (PARI)

%o parts(n, pred, y)={prod(k=1, n, 1 + if(pred(k), y*x^k + O(x*x^n), 0))}

%o {my(n=80); (Vec(parts(n, isprime, 1)) - Vec(parts(n, isprime, -1)))/2} \\ _Andrew Howroyd_, Dec 28 2017

%Y Cf. A000586, A184171, A184199.

%K nonn

%O 0,19

%A _Emeric Deutsch_ (suggested by _R. J. Mathar_), Jan 09 2011