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

%I #6 Dec 03 2020 20:27:16

%S 1,0,1,2,2,6,9,14,30,48,86,156,268,478,849,1486,2638,4660,8214,14532,

%T 25664,45304,80078,141412,249768,441276,779376,1376696,2431924,

%U 4295534,7587753,13403102,23674870,41819588,73870046,130483396,230486384,407130332,719153726

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

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

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

%F a(n) = (A023359(n) + A339422(n)) / 2.

%F a(n) = Sum_{k=0..n} A023359(k) * A339422(n-k).

%e 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].

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

%p add(b(n-2^i, 1-t), i=0..ilog2(n)))

%p end:

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

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

%t 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]

%Y Cf. A000079, A023359, A034008, A040039, A339422, A339427.

%K nonn

%O 0,4

%A _Ilya Gutkovskiy_, Dec 03 2020