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.

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