This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A342340 #17 Jun 10 2021 20:36:23 %S A342340 1,1,2,4,6,9,17,24,41,67,109,173,296,469,781,1284,2109,3450,5713,9349, %T A342340 15422,25351,41720,68590,112982,185753,305752,503041,827819,1361940, %U A342340 2241435,3687742,6068537,9985389,16431144,27036576,44489533,73205429,120460062,198214516,326161107 %N A342340 Number of compositions of n where each part after the first is either twice, half, or equal to the prior part. %H A342340 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 A342340 The a(1) = 1 through a(6) = 17 compositions: %e A342340 (1) (2) (3) (4) (5) (6) %e A342340 (11) (12) (22) (122) (24) %e A342340 (21) (112) (212) (33) %e A342340 (111) (121) (221) (42) %e A342340 (211) (1112) (222) %e A342340 (1111) (1121) (1122) %e A342340 (1211) (1212) %e A342340 (2111) (1221) %e A342340 (11111) (2112) %e A342340 (2121) %e A342340 (2211) %e A342340 (11112) %e A342340 (11121) %e A342340 (11211) %e A342340 (12111) %e A342340 (21111) %e A342340 (111111) %p A342340 b:= proc(n, i) option remember; `if`(n=0, 1, add( %p A342340 b(n-j, j), j=`if`(i=0, {$1..n}, select(x-> %p A342340 x::integer and x<=n, {i/2, i, 2*i})))) %p A342340 end: %p A342340 a:= n-> b(n, 0): %p A342340 seq(a(n), n=0..42); # _Alois P. Heinz_, May 24 2021 %t A342340 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 A342340 (* Second program: *) %t A342340 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 A342340 a[n_] := b[n, 0]; %t A342340 a /@ Range[0, 42] (* _Jean-François Alcover_, Jun 10 2021, after _Alois P. Heinz_ *) %o A342340 (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 A342340 The case of partitions is A342337. %Y A342340 The anti-run version is A342331. %Y A342340 A000929 counts partitions with adjacent parts x >= 2y. %Y A342340 A002843 counts compositions with adjacent parts x <= 2y. %Y A342340 A154402 counts partitions with adjacent parts x = 2y. %Y A342340 A224957 counts compositions with x <= 2y and y <= 2x (strict: A342342). %Y A342340 A274199 counts compositions with adjacent parts x < 2y. %Y A342340 A342094 counts partitions with adjacent x <= 2y (strict: A342095). %Y A342340 A342096 counts partitions without adjacent x >= 2y (strict: A342097). %Y A342340 A342098 counts partitions with adjacent parts x > 2y. %Y A342340 A342330 counts compositions with x < 2y and y < 2x (strict: A342341). %Y A342340 A342332 counts compositions with adjacent parts x > 2y or y > 2x. %Y A342340 A342333 counts compositions with adjacent parts x >= 2y or y >= 2x. %Y A342340 A342334 counts compositions with adjacent parts x >= 2y or y > 2x. %Y A342340 A342335 counts compositions with adjacent parts x >= 2y or y = 2x. %Y A342340 A342338 counts compositions with adjacent parts x < 2y and y <= 2x. %Y A342340 Cf. A000005, A003114, A003242, A034296, A167606, A342083, A342084, A342087, A342191, A342336, A342339. %K A342340 nonn %O A342340 0,3 %A A342340 _Gus Wiseman_, Mar 12 2021 %E A342340 Terms a(21) and beyond from _Andrew Howroyd_, Mar 13 2021