A342335 Number of compositions of n with all adjacent parts (x, y) satisfying x >= 2y or y = 2x.
1, 1, 1, 3, 3, 3, 7, 9, 9, 16, 21, 22, 36, 47, 51, 77, 101, 114, 165, 217, 251, 350, 459, 540, 733, 962, 1152, 1535, 2010, 2437, 3207, 4192, 5141, 6698, 8728, 10802, 13979, 18170, 22652, 29169, 37814, 47410, 60854, 78716, 99144, 126974, 163897, 207159, 264918, 341331, 432606, 552693, 711013, 903041, 1153060
Offset: 0
Keywords
Examples
The a(1) = 1 through a(9) = 16 compositions: (1) (2) (3) (4) (5) (6) (7) (8) (9) (12) (13) (14) (15) (16) (17) (18) (21) (121) (212) (24) (25) (26) (27) (42) (124) (125) (36) (213) (142) (215) (63) (1212) (214) (242) (126) (2121) (421) (1214) (216) (1213) (1421) (1215) (12121) (21212) (1242) (2124) (2142) (2421) (4212) (21213) (121212) (212121)
Links
- Andrew Howroyd, Table of n, a(n) for n = 0..1000
Crossrefs
The second condition alone gives A154402 for partitions.
The case of equality is A342331.
The version not allowing equality (i.e., strict relations) is A342336.
A224957 counts compositions with adjacent parts x <= 2y and y <= 2x.
A342098 counts partitions with adjacent parts x > 2y.
A342332 counts compositions with adjacent parts x > 2y or y > 2x.
A342333 counts compositions with adjacent parts x >= 2y or y >= 2x.
A342337 counts partitions with adjacent parts x = y or x = 2y.
A342338 counts compositions with adjacent parts x < 2y and y <= 2x.
A342342 counts strict compositions with adjacent parts x <= 2y and y <= 2x.
Programs
-
Mathematica
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],And@@Table[#[[i]]>=2*#[[i-1]]||#[[i-1]]==2*#[[i]],{i,2,Length[#]}]&]],{n,0,15}] (* Second program: *) 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}]]; pred[i_, j_] := i >= 2j || j == 2i; Join[{1}, c[60, pred]] (* Jean-François Alcover, Jun 10 2021, after Andrew Howroyd *)
-
PARI
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, ])} seq(n)={concat([1], C(n, (i,j)->i>=2*j || j==2*i))} \\ Andrew Howroyd, Mar 13 2021
Extensions
More terms from Joerg Arndt, Mar 12 2021
Comments