%I #43 Nov 23 2024 14:39:42
%S 1,1,1,2,2,2,4,6,5,6,8,10,12,15,19,22,25,28,37,41,46,62,72,79,95,113,
%T 123,144,176,200,232,268,311,363,412,485,577,658,743,875,999,1126,
%U 1338,1562,1767,2034,2365,2691,3088,3596,4152,4785,5479,6310,7273,8304,9573,11136,12799,14619,16910,19425,22142,25579
%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 Alois P. Heinz, <a href="/A342336/b342336.txt">Table of n, a(n) for n = 0..5000</a> (first 121 terms from David A. Corneth)
%H David A. Corneth, <a href="/A342336/a342336.gp.txt">PARI program</a>
%e The a(1) = 1 through a(12) = 12 compositions (A = 10, B = 11, C = 12):
%e 1 2 3 4 5 6 7 8 9 A B C
%e 21 13 14 15 16 17 18 19 1A 1B
%e 42 25 26 27 28 29 2A
%e 213 142 215 63 37 38 39
%e 214 1421 216 163 137 84
%e 421 2142 217 218 138
%e 4213 263 219
%e 21421 425 426
%e 4214 1425
%e 14213 2163
%e 4215
%e 14214
%p b:= proc(n, x) option remember; `if`(n=0, 1, add(
%p `if`(x=0 or x>2*y or y=2*x, b(n-y, y), 0), y=1..n))
%p end:
%p a:= n-> b(n, 0):
%p seq(a(n), n=0..80); # _Alois P. Heinz_, Mar 14 2021
%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 b[n_, x_] := b[n, x] = If[n == 0, 1, Sum[
%t If[x == 0 || x > 2y || y == 2x, b[n-y, y], 0], {y, 1, n}]];
%t a[n_] := b[n, 0];
%t a /@ Range[0, 80] (* _Jean-François Alcover_, May 09 2021, after _Alois P. Heinz_ *)
%o (PARI) \\ See PARI link. _David A. Corneth_, Mar 12 2021
%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 A274199, or A342098 for partitions.
%Y The second condition alone gives A154402 for partitions.
%Y The case of equality is A342331.
%Y The version allowing equality (i.e., non-strict relations) is A342335.
%Y A000929 counts partitions with adjacent parts x >= 2y.
%Y A002843 counts compositions with adjacent parts x <= 2y.
%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 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