A339409 Number of compositions (ordered partitions) of n into an odd number of primes.
0, 0, 1, 1, 0, 1, 1, 4, 3, 4, 7, 12, 19, 22, 32, 53, 80, 120, 160, 245, 368, 553, 800, 1164, 1736, 2588, 3813, 5598, 8226, 12228, 18060, 26657, 39221, 57945, 85656, 126506, 186584, 275307, 406514, 600488, 886255, 1308088, 1930648, 2850861, 4208743, 6212824, 9170440, 13538025
Offset: 0
Keywords
Examples
a(8) = 3 because we have [3, 3, 2], [3, 2, 3] and [2, 3, 3].
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, 0): 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))).