login
Number of compositions (ordered partitions) of n into two or more powers of 2.
1

%I #12 Dec 26 2022 11:39:47

%S 0,0,1,3,5,10,18,31,55,98,174,306,542,956,1690,2983,5271,9310,16448,

%T 29050,51318,90644,160118,282826,499590,882468,1558798,2753448,

%U 4863696,8591212,15175514,26805983,47350055,83639030,147739848,260967362,460972286,814260544,1438308328

%N Number of compositions (ordered partitions) of n into two or more powers of 2.

%F a(n) = A023359(n) - A209229(n) for n > 0.

%p b:= proc(n) option remember;

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

%p end:

%p a:= n-> b(n)-`if`(2^ilog2(n)=n, 1, 0):

%p seq(a(n), n=0..50); # _Alois P. Heinz_, Oct 02 2022

%t b[n_] := b[n] = If[n == 0, 1, Sum[b[n - 2^i], {i, 0, Floor@ Log2[n]}]];

%t a[n_] := b[n] - If[2^Floor@Log2[n] == n, 1, 0];

%t Table[a[n], {n, 0, 50}] (* _Jean-François Alcover_, Dec 26 2022, after _Alois P. Heinz_ *)

%Y Cf. A023359, A093659, A209229, A357476.

%K nonn

%O 0,4

%A _Ilya Gutkovskiy_, Oct 02 2022