A339408 Number of compositions (ordered partitions) of n into an even number of primes.
1, 0, 0, 0, 1, 2, 1, 2, 3, 6, 9, 8, 16, 24, 40, 52, 72, 112, 172, 256, 364, 528, 804, 1188, 1757, 2548, 3782, 5614, 8308, 12214, 17979, 26586, 39352, 58044, 85608, 126248, 186630, 275556, 406737, 600066, 885952, 1308250, 1931473, 2850692, 4207952, 6212110, 9171800, 13538980
Offset: 0
Keywords
Examples
a(8) = 3 because we have [5, 3], [3, 5] and [2, 2, 2, 2].
Programs
-
Maple
b:= proc(n, t) option remember; `if`(n=0, t, add( b(n-ithprime(j), 1-t), j=1..numtheory[pi](n))) end: a:= n-> b(n, 1): seq(a(n), n=0..55); # Alois P. Heinz, Dec 03 2020
-
Mathematica
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]
Formula
G.f.: (1/2) * (1 / (1 - Sum_{k>=1} x^prime(k)) + 1 / (1 + Sum_{k>=1} x^prime(k))).