Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #20 Jun 10 2021 07:42:34
%S 1,1,1,3,3,3,7,9,9,16,21,22,36,47,51,77,101,114,165,217,251,350,459,
%T 540,733,962,1152,1535,2010,2437,3207,4192,5141,6698,8728,10802,13979,
%U 18170,22652,29169,37814,47410,60854,78716,99144,126974,163897,207159,264918,341331,432606,552693,711013,903041,1153060
%N Number of compositions of n with all adjacent parts (x, y) satisfying x >= 2y or y = 2x.
%C Also the number of compositions of n with all adjacent parts (x, y) satisfying x = 2y or y >= 2x.
%H Andrew Howroyd, <a href="/A342335/b342335.txt">Table of n, a(n) for n = 0..1000</a>
%e The a(1) = 1 through a(9) = 16 compositions:
%e (1) (2) (3) (4) (5) (6) (7) (8) (9)
%e (12) (13) (14) (15) (16) (17) (18)
%e (21) (121) (212) (24) (25) (26) (27)
%e (42) (124) (125) (36)
%e (213) (142) (215) (63)
%e (1212) (214) (242) (126)
%e (2121) (421) (1214) (216)
%e (1213) (1421) (1215)
%e (12121) (21212) (1242)
%e (2124)
%e (2142)
%e (2421)
%e (4212)
%e (21213)
%e (121212)
%e (212121)
%t Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[i]]>=2*#[[i-1]]||#[[i-1]]==2*#[[i]],{i,2,Length[#]}]&]],{n,0,15}]
%t (* Second program: *)
%t c[n_, pred_] := Module[{M = IdentityMatrix[n], i, k}, For[k = 1, k <= n, k++, For[i = 1, i <= k-1, i++, M[[i, k]] = Sum[If[pred[j, i], M[[j, k-i]], 0], {j, 1, k-i}]]]; Sum[M[[q, All]], {q, 1, n}]];
%t pred[i_, j_] := i >= 2j || j == 2i;
%t Join[{1}, c[60, pred]] (* _Jean-François Alcover_, Jun 10 2021, after _Andrew Howroyd_ *)
%o (PARI)
%o C(n, pred)={my(M=matid(n)); for(k=1, n, for(i=1, k-1, M[i, k]=sum(j=1, k-i, if(pred(j, i), M[j, k-i], 0)))); sum(q=1, n, M[q, ])}
%o seq(n)={concat([1], C(n, (i,j)->i>=2*j || j==2*i))} \\ _Andrew Howroyd_, Mar 13 2021
%Y The first condition alone gives A002843, or A000929 for partitions.
%Y The second condition alone gives A154402 for partitions.
%Y The case of equality is A342331.
%Y The version not allowing equality (i.e., strict relations) is A342336.
%Y A224957 counts compositions with adjacent parts x <= 2y and y <= 2x.
%Y A224957 counts compositions with x <= 2y and y <= 2x (strict: A342342).
%Y A342094 counts partitions with adjacent parts 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 A342337 counts partitions with adjacent parts x = y or x = 2y.
%Y A342338 counts compositions with adjacent parts x < 2y and y <= 2x.
%Y A342342 counts strict compositions with adjacent parts x <= 2y and y <= 2x.
%Y Cf. A003114, A003242, A034296, A167606, A342083, A342084, A342087, A342191, A342334, A342340.
%K nonn
%O 0,4
%A _Gus Wiseman_, Mar 10 2021
%E More terms from _Joerg Arndt_, Mar 12 2021