login
Number of compositions (ordered partitions) of n into an even number of primes.
2

%I #6 Dec 03 2020 12:49:02

%S 1,0,0,0,1,2,1,2,3,6,9,8,16,24,40,52,72,112,172,256,364,528,804,1188,

%T 1757,2548,3782,5614,8308,12214,17979,26586,39352,58044,85608,126248,

%U 186630,275556,406737,600066,885952,1308250,1931473,2850692,4207952,6212110,9171800,13538980

%N Number of compositions (ordered partitions) of n into an even number of primes.

%H <a href="/index/Com#comp">Index entries for sequences related to compositions</a>

%F G.f.: (1/2) * (1 / (1 - Sum_{k>=1} x^prime(k)) + 1 / (1 + Sum_{k>=1} x^prime(k))).

%e a(8) = 3 because we have [5, 3], [3, 5] and [2, 2, 2, 2].

%p b:= proc(n, t) option remember; `if`(n=0, t, add(

%p b(n-ithprime(j), 1-t), j=1..numtheory[pi](n)))

%p end:

%p a:= n-> b(n, 1):

%p seq(a(n), n=0..55); # _Alois P. Heinz_, Dec 03 2020

%t nmax = 47; CoefficientList[Series[(1/2) (1/(1 - Sum[x^Prime[k], {k, 1, nmax}]) + 1/(1 + Sum[x^Prime[k], {k, 1, nmax}])), {x, 0, nmax}], x]

%Y Cf. A000040, A023360, A034008, A184198, A339380, A339409.

%K nonn

%O 0,6

%A _Ilya Gutkovskiy_, Dec 03 2020