A339426 Number of compositions (ordered partitions) of n into an even number of powers of 2.
1, 0, 1, 2, 2, 6, 9, 14, 30, 48, 86, 156, 268, 478, 849, 1486, 2638, 4660, 8214, 14532, 25664, 45304, 80078, 141412, 249768, 441276, 779376, 1376696, 2431924, 4295534, 7587753, 13403102, 23674870, 41819588, 73870046, 130483396, 230486384, 407130332, 719153726
Offset: 0
Keywords
Examples
a(5) = 6 because we have [4, 1], [1, 4], [2, 1, 1, 1], [1, 2, 1, 1], [1, 1, 2, 1] and [1, 1, 1, 2].
Programs
-
Maple
b:= proc(n, t) option remember; `if`(n=0, t, add(b(n-2^i, 1-t), i=0..ilog2(n))) end: a:= n-> b(n, 1): seq(a(n), n=0..42); # Alois P. Heinz, Dec 03 2020
-
Mathematica
nmax = 38; CoefficientList[Series[(1/2) (1/(1 - Sum[x^(2^k), {k, 0, Floor[Log[2, nmax]] + 1}]) + 1/(1 + Sum[x^(2^k), {k, 0, Floor[Log[2, nmax]] + 1}])), {x, 0, nmax}], x]