Search: a131044 -id:a131044
|
|
A261983
|
|
Number of compositions of n such that at least two adjacent parts are equal.
|
|
+10
49
|
|
|
0, 0, 1, 1, 4, 9, 18, 41, 89, 185, 388, 810, 1670, 3435, 7040, 14360, 29226, 59347, 120229, 243166, 491086, 990446, 1995410, 4016259, 8076960, 16231746, 32599774, 65437945, 131293192, 263316897, 527912140, 1058061751, 2120039885, 4246934012, 8505864640
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
a(5) = 9: 311, 113, 221, 122, 2111, 1211, 1121, 1112, 11111.
The a(2) = 1 through a(6) = 18 compositions:
(1,1) (1,1,1) (2,2) (1,1,3) (3,3)
(1,1,2) (1,2,2) (1,1,4)
(2,1,1) (2,2,1) (2,2,2)
(1,1,1,1) (3,1,1) (4,1,1)
(1,1,1,2) (1,1,1,3)
(1,1,2,1) (1,1,2,2)
(1,2,1,1) (1,1,3,1)
(2,1,1,1) (1,2,2,1)
(1,1,1,1,1) (1,3,1,1)
(2,1,1,2)
(2,2,1,1)
(3,1,1,1)
(1,1,1,1,2)
(1,1,1,2,1)
(1,1,2,1,1)
(1,2,1,1,1)
(2,1,1,1,1)
(1,1,1,1,1,1)
(End)
|
|
MAPLE
|
b:= proc(n, i) option remember; `if`(n=0, 0, add(
`if`(i=j, ceil(2^(n-j-1)), b(n-j, j)), j=1..n))
end:
a:= n-> b(n, 0):
seq(a(n), n=0..40);
|
|
MATHEMATICA
|
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], MatchQ[#, {___, x_, x_, ___}]&]], {n, 0, 10}] (* Gus Wiseman, Jul 06 2020 *)
b[n_, i_] := b[n, i] = If[n == 0, 0, Sum[If[i == j, Ceiling[2^(n-j-1)], b[n-j, j]], {j, 1, n}]];
a[n_] := b[n, 0];
|
|
CROSSREFS
|
The complement A003242 counts anti-runs.
Sum of positive-indexed terms of row n of A106356.
The (1,1,1) matching case is A335464.
Compositions with adjacent parts coprime are A167606.
Compositions with equal parts contiguous are A274174.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A373954
|
|
Excess run-compression of standard compositions. Sum of all parts minus sum of compressed parts of the n-th integer composition in standard order.
|
|
+10
40
|
|
|
0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 2, 1, 0, 0, 1, 3, 0, 0, 0, 1, 0, 2, 0, 2, 0, 0, 2, 1, 1, 1, 2, 4, 0, 0, 0, 1, 3, 0, 0, 2, 0, 0, 4, 3, 0, 0, 1, 3, 0, 0, 0, 1, 0, 2, 0, 2, 1, 1, 3, 2, 2, 2, 3, 5, 0, 0, 0, 1, 0, 0, 0, 2, 0, 3, 2, 1, 0, 0, 1, 3, 0, 0, 0, 1, 2, 4, 2
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,8
|
|
COMMENTS
|
The k-th composition in standard order (graded reverse-lexicographic, A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again. This gives a bijective correspondence between nonnegative integers and integer compositions.
We define the (run-) compression of a sequence to be the anti-run obtained by reducing each run of repeated parts to a single part. Alternatively, compression removes all parts equal to the part immediately to their left. For example, (1,1,2,2,1) has compression (1,2,1).
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
The excess compression of (2,1,1,3) is 1, so a(92) = 1.
|
|
MATHEMATICA
|
stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
Table[Total[stc[n]]-Total[First/@Split[stc[n]]], {n, 0, 100}]
|
|
CROSSREFS
|
Compression of standard compositions is A373953.
A037201 gives compression of first differences of primes, halved A373947.
A066099 lists the parts of all compositions in standard order.
A114901 counts compositions with no isolated parts.
A240085 counts compositions with no unique parts.
A333627 takes the rank of a composition to the rank of its run-lengths.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A106351
|
|
Triangle read by rows: T(n,k) = number of compositions of n into k parts such that no two adjacent parts are equal.
|
|
+10
34
|
|
|
1, 1, 0, 1, 2, 0, 1, 2, 1, 0, 1, 4, 2, 0, 0, 1, 4, 7, 2, 0, 0, 1, 6, 9, 6, 1, 0, 0, 1, 6, 15, 14, 3, 0, 0, 0, 1, 8, 21, 24, 15, 2, 0, 0, 0, 1, 8, 28, 46, 30, 10, 1, 0, 0, 0, 1, 10, 35, 66, 68, 30, 4, 0, 0, 0, 0, 1, 10, 46, 100, 119, 76, 24, 2, 0, 0, 0, 0, 1, 12, 54, 138, 204, 168, 69, 14, 1, 0, 0, 0, 0
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,5
|
|
LINKS
|
A. Knopfmacher and H. Prodinger, On Carlitz compositions, European Journal of Combinatorics, Vol. 19, 1998, pp. 579-589.
|
|
FORMULA
|
G.f.: 1/(1 - Sum_{k>0} (-1)^(k+1)*x^k*y^k/(1-x^k).
|
|
EXAMPLE
|
T(6,3) = 7 because the compositions of 6 into 3 parts with no adjacent equal parts are 3+2+1, 3+1+2, 2+3+1, 2+1+3, 1+3+2, 1+2+3, 1+4+1.
Triangle begins:
1;
1, 0;
1, 2, 0;
1, 2, 1, 0;
1, 4, 2, 0, 0;
1, 4, 7, 2, 0, 0;
1, 6, 9, 6, 1, 0, 0;
1, 6, 15, 14, 3, 0, 0, 0;
1, 8, 21, 24, 15, 2, 0, 0, 0;
...
|
|
MAPLE
|
b:= proc(n, h, t) option remember;
if n<t then 0
elif n=0 then `if`(t=0, 1, 0)
else add(`if`(h=j, 0, b(n-j, j, t-1)), j=1..n)
fi
end:
T:= (n, k)-> b(n, -1, k):
|
|
MATHEMATICA
|
nn=10; CoefficientList[Series[1/(1-Sum[y x^i/(1+y x^i), {i, 1, nn}]), {x, 0, nn}], {x, y}]//Grid (* Geoffrey Critzer, Nov 23 2013 *)
|
|
PROG
|
(PARI)
gf(n, y)={1/(1 - sum(k=1, n, (-1)^(k+1)*x^k*y^k/(1-x^k) + O(x*x^n)))}
for(n=1, 10, my(p=polcoeff(gf(n, y), n)); for(k=1, n, print1(polcoeff(p, k), ", ")); print); \\ Andrew Howroyd, Oct 12 2017
|
|
CROSSREFS
|
Cf. A131044 (at least two adjacent parts are equal).
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A348612
|
|
Numbers k such that the k-th composition in standard order is not an anti-run, i.e., has adjacent equal parts.
|
|
+10
32
|
|
|
3, 7, 10, 11, 14, 15, 19, 21, 23, 26, 27, 28, 29, 30, 31, 35, 36, 39, 42, 43, 46, 47, 51, 53, 55, 56, 57, 58, 59, 60, 61, 62, 63, 67, 71, 73, 74, 75, 78, 79, 83, 84, 85, 86, 87, 90, 91, 92, 93, 94, 95, 99, 100, 103, 106, 107, 110, 111, 112, 113, 114, 115, 116
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
First differs from A345168 in lacking 37, corresponding to the composition (3,2,1).
A composition of n is a finite sequence of positive integers summing to n. The k-th composition in standard order (row k of A066099) is obtained by taking the set of positions of 1's in the reversed binary expansion of k, prepending 0, taking first differences, and reversing again.
|
|
LINKS
|
|
|
EXAMPLE
|
The terms and corresponding standard compositions begin:
3: (1,1) 35: (4,1,1) 61: (1,1,1,2,1)
7: (1,1,1) 36: (3,3) 62: (1,1,1,1,2)
10: (2,2) 39: (3,1,1,1) 63: (1,1,1,1,1,1)
11: (2,1,1) 42: (2,2,2) 67: (5,1,1)
14: (1,1,2) 43: (2,2,1,1) 71: (4,1,1,1)
15: (1,1,1,1) 46: (2,1,1,2) 73: (3,3,1)
19: (3,1,1) 47: (2,1,1,1,1) 74: (3,2,2)
21: (2,2,1) 51: (1,3,1,1) 75: (3,2,1,1)
23: (2,1,1,1) 53: (1,2,2,1) 78: (3,1,1,2)
26: (1,2,2) 55: (1,2,1,1,1) 79: (3,1,1,1,1)
27: (1,2,1,1) 56: (1,1,4) 83: (2,3,1,1)
28: (1,1,3) 57: (1,1,3,1) 84: (2,2,3)
29: (1,1,2,1) 58: (1,1,2,2) 85: (2,2,2,1)
30: (1,1,1,2) 59: (1,1,2,1,1) 86: (2,2,1,2)
31: (1,1,1,1,1) 60: (1,1,1,3) 87: (2,2,1,1,1)
|
|
MATHEMATICA
|
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n, 2]], 1], 0]]//Reverse;
Select[Range[100], MatchQ[stc[#], {___, x_, x_, ___}]&]
|
|
CROSSREFS
|
Counting these compositions by sum and length gives A131044.
These compositions are counted by A261983.
A238279 counts compositions by sum and number of maximal runs.
A274174 counts compositions with equal parts contiguous.
A336107 counts non-anti-run permutations of prime factors.
For compositions in standard order (rows of A066099):
- Maximal runs are counted by A124767.
- Strict compositions are ranked by A233564.
- Maximal anti-runs are counted by A333381.
Cf. A029931, A048793, A106356, A114901, A167606, A178470, A228351, A244164, A262046, A335452, A335464.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A357182
|
|
Number of integer compositions of n with the same length as their alternating sum.
|
|
+10
26
|
|
|
1, 1, 0, 0, 1, 3, 1, 4, 6, 20, 13, 48, 50, 175, 141, 512, 481, 1719, 1491, 5400, 4929, 17776, 15840, 57420, 52079, 188656, 169989, 617176, 559834, 2033175, 1842041, 6697744, 6085950, 22139780, 20123989, 73262232, 66697354, 242931321, 221314299, 806516560
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,6
|
|
COMMENTS
|
A composition of n is a finite sequence of positive integers summing to n.
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
|
|
LINKS
|
|
|
EXAMPLE
|
The a(1) = 1 through a(8) = 6 compositions:
(1) (31) (113) (42) (124) (53)
(212) (223) (1151)
(311) (322) (2141)
(421) (3131)
(4121)
(5111)
|
|
MATHEMATICA
|
ats[y_]:=Sum[(-1)^(i-1)*y[[i]], {i, Length[y]}];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], Length[#]==ats[#]&]], {n, 0, 15}]
|
|
CROSSREFS
|
For product instead of length we have A114220.
For sum equal to twice alternating sum we have A262977, ranked by A348614.
For absolute value we have A357183.
These compositions are ranked by A357184.
A124754 gives alternating sums of standard compositions.
A238279 counts compositions by sum and number of maximal runs.
A261983 counts non-anti-run compositions.
A357136 counts compositions by alternating sum.
Cf. A000120, A032020, A070939, A106356, A114901, A131044, A178470, A233564, A242882, A262046, A301987.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A335548
|
|
Number of compositions of n with at least one non-contiguous value.
|
|
+10
25
|
|
|
0, 0, 0, 0, 1, 4, 10, 28, 68, 159, 350, 770, 1642, 3468, 7218, 14870, 30463, 62044, 125818, 254302, 512690, 1031284, 2071858, 4157214, 8334742, 16699103, 33442208, 66947772, 133986940, 268107104, 536404872, 1073082978, 2146555516, 4293665006, 8588112822
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,6
|
|
COMMENTS
|
Also the number of compositions of n matching the pattern (1,2,1) or (2,1,2).
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
The a(4) = 1 through a(6) = 10 compositions:
(121) (131) (141)
(212) (1131)
(1121) (1212)
(1211) (1221)
(1311)
(2112)
(2121)
(11121)
(11211)
(12111)
|
|
MAPLE
|
b:= proc(n, i, p) option remember; `if`(n=0, p!, `if`(i<1, 0,
add(b(n-i*j, i-1, p+`if`(j=0, 0, 1)), j=0..n/i)))
end:
a:= n-> ceil(2^(n-1))-b(n$2, 0):
|
|
MATHEMATICA
|
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], Length[Split[#]]>Length[Union[#]]&]], {n, 0, 10}]
(* Second program: *)
b[n_, i_, p_] := b[n, i, p] = If[n == 0, p!, If[i<1, 0,
Sum[b[n-i*j, i-1, p + If[j == 0, 0, 1]], {j, 0, n/i}]]];
a[n_] := Ceiling[2^(n-1)] - b[n, n, 0];
|
|
CROSSREFS
|
The version for prime indices is A335460.
(1,2,1) and (2,1,2)-matching permutations of prime indices are A335462.
(1,2,1)-matching compositions are A335470.
(1,2,1)-avoiding compositions are A335471.
(2,1,2)-matching compositions are A335472.
(2,1,2)-avoiding compositions are A335473.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A357189
|
|
Number of integer partitions of n with the same length as alternating sum.
|
|
+10
25
|
|
|
1, 1, 0, 0, 1, 1, 1, 2, 2, 4, 3, 5, 6, 9, 9, 13, 16, 23, 23, 34, 37, 54, 54, 78, 84, 120, 121, 170, 182, 252, 260, 358, 379, 517, 535, 725, 764, 1030, 1064, 1427, 1494, 1992, 2059, 2733, 2848, 3759, 3887, 5106, 5311, 6946, 7177, 9345, 9701, 12577, 12996, 16788
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,8
|
|
COMMENTS
|
A partition of n is a weakly decreasing sequence of positive integers summing to n.
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
|
|
LINKS
|
|
|
EXAMPLE
|
The a(4) = 1 through a(13) = 9 partitions:
31 311 42 322 53 333 64 443 75 553
421 5111 432 5221 542 5331 652
531 6211 641 6222 751
51111 52211 6321 52222
62111 7311 53311
711111 62221
63211
73111
7111111
|
|
MATHEMATICA
|
ats[y_]:=Sum[(-1)^(i-1)*y[[i]], {i, Length[y]}];
Table[Length[Select[IntegerPartitions[n], Length[#]==ats[#]&]], {n, 0, 30}]
|
|
CROSSREFS
|
For sum equal to twice alternating sum we have A357189 (this sequence).
These partitions are ranked by A357486.
A025047 counts alternating compositions.
A357136 counts compositions by alternating sum, full triangle A097805.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A128695
|
|
Number of compositions of n with parts in N which avoid the adjacent pattern 111.
|
|
+10
20
|
|
|
1, 1, 2, 3, 7, 13, 24, 46, 89, 170, 324, 618, 1183, 2260, 4318, 8249, 15765, 30123, 57556, 109973, 210137, 401525, 767216, 1465963, 2801115, 5352275, 10226930, 19541236, 37338699, 71345449, 136324309, 260483548, 497722578, 951030367
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
FORMULA
|
G.f.: 1/(1-Sum(i>=1, x^i*(1+x^i)/(1+x^i*(1+x^i)) ) ).
a(n) ~ c * d^n, where d is the root of the equation Sum_{k>=1} 1/(d^k + 1/(1 + d^k)) = 1, d=1.9107639262818041675000243699745706859615884029961947632387839..., c=0.4993008137128378086219448701860326113802027003939127932922782... - Vaclav Kotesovec, May 01 2014, updated Jul 07 2020
|
|
EXAMPLE
|
The a(0) = 1 through a(5) = 13 compositions:
() (1) (2) (3) (4) (5)
(1,1) (1,2) (1,3) (1,4)
(2,1) (2,2) (2,3)
(3,1) (3,2)
(1,1,2) (4,1)
(1,2,1) (1,1,3)
(2,1,1) (1,2,2)
(1,3,1)
(2,1,2)
(2,2,1)
(3,1,1)
(1,1,2,1)
(1,2,1,1)
(End)
|
|
MAPLE
|
b:= proc(n, t) option remember; `if`(n=0, 1, add(`if`(abs(t)<>j,
b(n-j, j), `if`(t=-j, 0, b(n-j, -j))), j=1..n))
end:
a:= n-> b(n, 0):
|
|
MATHEMATICA
|
nn=33; CoefficientList[Series[1/(1-Sum[(x^i+x^(2i))/(1+x^i+x^(2i)), {i, 1, nn}]), {x, 0, nn}], x] (* Geoffrey Critzer, Nov 23 2013 *)
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], !MatchQ[#, {___, x_, x_, x_, ___}]&]], {n, 13}] (* Gus Wiseman, Jul 06 2020 *)
|
|
CROSSREFS
|
Contiguously (1,1)-avoiding compositions is A003242.
Contiguously (1,1)-matching compositions are A261983.
Compositions with some part > 2 are A008466
Compositions by number of adjacent equal parts are A106356.
Compositions where each part is adjacent to an equal part are A114901.
Compositions with adjacent parts coprime are A167606.
Compositions with equal parts contiguous are A274174.
Patterns contiguously matched by compositions are A335457.
Patterns contiguously matched by a given partition are A335516.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|
|
A357488
|
|
Number of integer partitions of 2n - 1 with the same length as alternating sum.
|
|
+10
19
|
|
|
1, 0, 1, 2, 4, 5, 9, 13, 23, 34, 54, 78, 120, 170, 252, 358, 517, 725, 1030, 1427, 1992, 2733, 3759, 5106, 6946, 9345, 12577, 16788, 22384, 29641, 39199, 51529, 67626, 88307, 115083, 149332, 193383, 249456, 321134, 411998, 527472, 673233, 857539, 1089223, 1380772
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,4
|
|
COMMENTS
|
A partition of n is a weakly decreasing sequence of positive integers summing to n.
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
The a(1) = 1 through a(7) = 9 partitions:
(1) . (311) (322) (333) (443) (553)
(421) (432) (542) (652)
(531) (641) (751)
(51111) (52211) (52222)
(62111) (53311)
(62221)
(63211)
(73111)
(7111111)
|
|
MATHEMATICA
|
ats[y_]:=Sum[(-1)^(i-1)*y[[i]], {i, Length[y]}];
Table[Length[Select[IntegerPartitions[n], Length[#]==ats[#]&]], {n, 1, 30, 2}]
|
|
CROSSREFS
|
The version for compositions appears to be A222763, odd version of A357182.
These partitions are ranked by the odd-sum portion of A357485.
Except at the start, alternately adding zeros gives A357487.
A025047 counts alternating compositions.
A357136 counts compositions by alternating sum, full triangle A097805.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|
|
A357183
|
|
Number of integer compositions with the same length as the absolute value of their alternating sum.
|
|
+10
18
|
|
|
1, 1, 0, 0, 2, 3, 2, 5, 12, 22, 26, 58, 100, 203, 282, 616, 962, 2045, 2982, 6518, 9858, 21416, 31680, 69623, 104158, 228930, 339978, 751430, 1119668, 2478787, 3684082, 8182469, 12171900, 27082870, 40247978, 89748642, 133394708, 297933185, 442628598, 990210110
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,5
|
|
COMMENTS
|
A composition of n is a finite sequence of positive integers summing to n.
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
|
|
LINKS
|
|
|
EXAMPLE
|
The a(1) = 1 through a(8) = 12 compositions:
(1) (13) (113) (24) (124) (35)
(31) (212) (42) (151) (53)
(311) (223) (1115)
(322) (1151)
(421) (1214)
(1313)
(1412)
(1511)
(2141)
(3131)
(4121)
(5111)
|
|
MATHEMATICA
|
ats[y_]:=Sum[(-1)^(i-1)*y[[i]], {i, Length[y]}];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], Length[#]==Abs[ats[#]]&]], {n, 0, 15}]
|
|
CROSSREFS
|
For product instead of length we have A114220.
For sum equal to twice alternating sum we have A262977, ranked by A348614.
This is the absolute value version of A357182.
These compositions are ranked by A357185.
A124754 gives alternating sums of standard compositions.
A238279 counts compositions by sum and number of maximal runs.
A261983 counts non-anti-run compositions.
A357136 counts compositions by alternating sum.
Cf. A000120, A032020, A070939, A106356, A114901, A131044, A178470, A233564, A242882, A262046, A301987.
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
Search completed in 0.014 seconds
|