cp's OEIS Frontend

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.

A342336 Number of compositions of n with all adjacent parts (x, y) satisfying x > 2y or y = 2x.

This page as a plain text file.
%I A342336 #43 Nov 23 2024 14:39:42
%S A342336 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 A342336 123,144,176,200,232,268,311,363,412,485,577,658,743,875,999,1126,
%U A342336 1338,1562,1767,2034,2365,2691,3088,3596,4152,4785,5479,6310,7273,8304,9573,11136,12799,14619,16910,19425,22142,25579
%N A342336 Number of compositions of n with all adjacent parts (x, y) satisfying x > 2y or y = 2x.
%C A342336 Also the number of compositions of n with all adjacent parts (x, y) satisfying x = 2y or y > 2x.
%H A342336 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 A342336 David A. Corneth, <a href="/A342336/a342336.gp.txt">PARI program</a>
%e A342336 The a(1) = 1 through a(12) = 12 compositions (A = 10, B = 11, C = 12):
%e A342336   1   2   3    4    5    6     7     8      9      A       B       C
%e A342336           21   13   14   15    16    17     18     19      1A      1B
%e A342336                          42    25    26     27     28      29      2A
%e A342336                          213   142   215    63     37      38      39
%e A342336                                214   1421   216    163     137     84
%e A342336                                421          2142   217     218     138
%e A342336                                                    4213    263     219
%e A342336                                                    21421   425     426
%e A342336                                                            4214    1425
%e A342336                                                            14213   2163
%e A342336                                                                    4215
%e A342336                                                                    14214
%p A342336 b:= proc(n, x) option remember; `if`(n=0, 1, add(
%p A342336      `if`(x=0 or x>2*y or y=2*x, b(n-y, y), 0), y=1..n))
%p A342336     end:
%p A342336 a:= n-> b(n, 0):
%p A342336 seq(a(n), n=0..80);  # _Alois P. Heinz_, Mar 14 2021
%t A342336 Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[i]]>2*#[[i-1]]||#[[i-1]]==2*#[[i]],{i,2,Length[#]}]&]],{n,0,15}]
%t A342336 (* Second program: *)
%t A342336 b[n_, x_] := b[n, x] = If[n == 0, 1, Sum[
%t A342336      If[x == 0 || x > 2y || y == 2x, b[n-y, y], 0], {y, 1, n}]];
%t A342336 a[n_] := b[n, 0];
%t A342336 a /@ Range[0, 80] (* _Jean-François Alcover_, May 09 2021, after _Alois P. Heinz_ *)
%o A342336 (PARI) \\ See PARI link. _David A. Corneth_, Mar 12 2021
%o A342336 (PARI)
%o A342336 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 A342336 seq(n)={concat([1], C(n, (i,j)->i>2*j || j==2*i))} \\ _Andrew Howroyd_, Mar 13 2021
%Y A342336 The first condition alone gives A274199, or A342098 for partitions.
%Y A342336 The second condition alone gives A154402 for partitions.
%Y A342336 The case of equality is A342331.
%Y A342336 The version allowing equality (i.e., non-strict relations) is A342335.
%Y A342336 A000929 counts partitions with adjacent parts x >= 2y.
%Y A342336 A002843 counts compositions with adjacent parts x <= 2y.
%Y A342336 A224957 counts compositions with x <= 2y and y <= 2x (strict: A342342).
%Y A342336 A342094 counts partitions with adjacent parts x <= 2y (strict: A342095).
%Y A342336 A342096 counts partitions without adjacent x >= 2y (strict: A342097).
%Y A342336 A342330 counts compositions with x < 2y and y < 2x (strict: A342341).
%Y A342336 A342332 counts compositions with adjacent parts x > 2y or y > 2x.
%Y A342336 A342333 counts compositions with adjacent parts x >= 2y or y >= 2x.
%Y A342336 A342337 counts partitions with adjacent parts x = y or x = 2y.
%Y A342336 A342338 counts compositions with adjacent parts x < 2y and y <= 2x.
%Y A342336 A342342 counts strict compositions with adjacent parts x <= 2y and y <= 2x.
%Y A342336 Cf. A003114, A003242, A034296, A167606, A342083, A342084, A342087, A342191, A342334, A342340.
%K A342336 nonn
%O A342336 0,4
%A A342336 _Gus Wiseman_, Mar 10 2021
%E A342336 More terms from _Joerg Arndt_, Mar 12 2021