%I #17 Jun 10 2021 20:36:23
%S 1,1,2,4,6,9,17,24,41,67,109,173,296,469,781,1284,2109,3450,5713,9349,
%T 15422,25351,41720,68590,112982,185753,305752,503041,827819,1361940,
%U 2241435,3687742,6068537,9985389,16431144,27036576,44489533,73205429,120460062,198214516,326161107
%N Number of compositions of n where each part after the first is either twice, half, or equal to the prior part.
%H Alois P. Heinz, <a href="/A342340/b342340.txt">Table of n, a(n) for n = 0..4623</a> (first 1001 terms from Andrew Howroyd)
%e The a(1) = 1 through a(6) = 17 compositions:
%e (1) (2) (3) (4) (5) (6)
%e (11) (12) (22) (122) (24)
%e (21) (112) (212) (33)
%e (111) (121) (221) (42)
%e (211) (1112) (222)
%e (1111) (1121) (1122)
%e (1211) (1212)
%e (2111) (1221)
%e (11111) (2112)
%e (2121)
%e (2211)
%e (11112)
%e (11121)
%e (11211)
%e (12111)
%e (21111)
%e (111111)
%p b:= proc(n, i) option remember; `if`(n=0, 1, add(
%p b(n-j, j), j=`if`(i=0, {$1..n}, select(x->
%p x::integer and x<=n, {i/2, i, 2*i}))))
%p end:
%p a:= n-> b(n, 0):
%p seq(a(n), n=0..42); # _Alois P. Heinz_, May 24 2021
%t Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[i]]==#[[i-1]]||#[[i]]==2*#[[i-1]]||#[[i-1]]==2*#[[i]],{i,2,Length[#]}]&]],{n,0,15}]
%t (* Second program: *)
%t b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j], {j, If[i == 0, Range[n], Select[ {i/2, i, 2 i}, IntegerQ[#] && # <= n &]]}]];
%t a[n_] := b[n, 0];
%t a /@ Range[0, 42] (* _Jean-François Alcover_, Jun 10 2021, after _Alois P. Heinz_ *)
%o (PARI) seq(n)={my(M=matid(n)); for(k=1, n, for(i=1, k-1, M[i, k] = if(i%2==0, M[i/2,k-i]) + if(i*2<=k, M[i,k-i]) + if(i*3<=k, M[i*2,k-i]))); concat([1], sum(q=1, n, M[q, ]))} \\ _Andrew Howroyd_, Mar 13 2021
%Y The case of partitions is A342337.
%Y The anti-run version is A342331.
%Y A000929 counts partitions with adjacent parts x >= 2y.
%Y A002843 counts compositions with adjacent parts x <= 2y.
%Y A154402 counts partitions with adjacent parts x = 2y.
%Y A224957 counts compositions with x <= 2y and y <= 2x (strict: A342342).
%Y A274199 counts compositions with adjacent parts x < 2y.
%Y A342094 counts partitions with adjacent x <= 2y (strict: A342095).
%Y A342096 counts partitions without adjacent x >= 2y (strict: A342097).
%Y A342098 counts partitions with adjacent parts x > 2y.
%Y A342330 counts compositions with x < 2y and y < 2x (strict: A342341).
%Y A342332 counts compositions with adjacent parts x > 2y or y > 2x.
%Y A342333 counts compositions with adjacent parts x >= 2y or y >= 2x.
%Y A342334 counts compositions with adjacent parts x >= 2y or y > 2x.
%Y A342335 counts compositions with adjacent parts x >= 2y or y = 2x.
%Y A342338 counts compositions with adjacent parts x < 2y and y <= 2x.
%Y Cf. A000005, A003114, A003242, A034296, A167606, A342083, A342084, A342087, A342191, A342336, A342339.
%K nonn
%O 0,3
%A _Gus Wiseman_, Mar 12 2021
%E Terms a(21) and beyond from _Andrew Howroyd_, Mar 13 2021