A097805 Number of compositions of n with k parts, T(n, k) = binomial(n-1, k-1) for n, k >= 1 and T(n, 0) = 0^n, triangle read by rows for n >= 0 and 0 <= k <= n.
1, 0, 1, 0, 1, 1, 0, 1, 2, 1, 0, 1, 3, 3, 1, 0, 1, 4, 6, 4, 1, 0, 1, 5, 10, 10, 5, 1, 0, 1, 6, 15, 20, 15, 6, 1, 0, 1, 7, 21, 35, 35, 21, 7, 1, 0, 1, 8, 28, 56, 70, 56, 28, 8, 1, 0, 1, 9, 36, 84, 126, 126, 84, 36, 9, 1, 0, 1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1, 0, 1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1
Offset: 0
A345197 Concatenation of square matrices A(n), each read by rows, where A(n)(k,i) is the number of compositions of n of length k with alternating sum i, where 1 <= k <= n, and i ranges from -n + 2 to n in steps of 2.
1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 2, 3, 0, 0, 2, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 2, 3, 4, 0, 0, 3, 4, 3, 0, 0, 0, 0, 2, 3, 0, 0, 0, 0, 1, 0, 0, 0
Offset: 0
Comments
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
Examples
The matrices for n = 1..7: 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0 0 1 0 0 1 2 0 0 1 2 3 0 0 1 2 3 4 0 0 1 2 3 4 5 0 0 1 0 0 0 2 2 0 0 0 3 4 3 0 0 0 4 6 6 4 0 0 0 0 1 0 0 0 0 2 3 0 0 0 0 3 6 6 0 0 0 0 1 0 0 0 0 0 3 3 0 0 0 0 0 0 1 0 0 0 Matrix n = 5 counts the following compositions: i=-3: i=-1: i=1: i=3: i=5: ----------------------------------------------------------------- k=1: | 0 0 0 0 (5) k=2: | (14) (23) (32) (41) 0 k=3: | 0 (131) (221)(122) (311)(113)(212) 0 k=4: | 0 (1211)(1112) (2111)(1121) 0 0 k=5: | 0 0 (11111) 0 0
Links
- Gus Wiseman, A raster plot of the zeros in A(16).
Crossrefs
The number of nonzero terms in each matrix appears to be A000096.
The number of zeros in each matrix appears to be A000124.
Row sums and column sums both appear to be A007318 (Pascal's triangle).
The matrix sums are A131577.
Antidiagonal sums appear to be A163493.
The reverse-alternating version is also A345197 (this sequence).
Antidiagonals are A345907.
Traces are A345908.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A344610 counts partitions by sum and positive reverse-alternating sum.
A344611 counts partitions of 2n with reverse-alternating sum >= 0.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
Programs
-
Mathematica
ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}]; Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[#]==k&&ats[#]==i&]],{n,0,6},{k,1,n},{i,-n+2,n,2}]
A294175 a(n) = 2^(n-1) + ((1+(-1)^n)/4)*binomial(n, n/2) - binomial(n, floor(n/2)).
0, 0, 1, 1, 5, 6, 22, 29, 93, 130, 386, 562, 1586, 2380, 6476, 9949, 26333, 41226, 106762, 169766, 431910, 695860, 1744436, 2842226, 7036530, 11576916, 28354132, 47050564, 114159428, 190876696, 459312152, 773201629, 1846943453, 3128164186, 7423131482
Offset: 0
Keywords
Comments
Number of subsets of {1,2,...,n} that contain more even than odd numbers.
Note that A058622 counts the nonempty subsets of {1,2,...,n} that contain more odd than even numbers.
From Gus Wiseman, Jul 22 2021: (Start)
Also the number of integer compositions of n + 1 with alternating sum < 0, where the alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i. For example, the a(0) = 0 through a(6) = 6 compositions (empty columns indicated by dots) are:
. . (12) (13) (14) (15)
(23) (24)
(131) (141)
(1112) (1113)
(1211) (1212)
(1311)
Also the number of integer compositions of n + 1 with reverse-alternating sum < 0. For a bijection, keep the odd-length compositions and reverse the even-length ones.
Also the number of (n+1)-digit binary numbers with more 0's than 1's. For example, the a(0) = 0 through a(5) = 6 binary numbers are:
. . 100 1000 10000 100000
10001 100001
10010 100010
10100 100100
11000 101000
110000
(End)
2*a(n) is the number of all-positive pinnacle sets that are admissible in the group S_{n+1}^B of signed permutations, but not admissible in S_{n+1}. - Bridget Tenner, Jan 06 2023
Examples
For example, for n=5, a(5)=6 and the 6 subsets are {2}, {4}, {2,4}, {1,2,4}, {2,3,4}, {2,4,5}.
Links
- Nicolle González, Pamela E. Harris, Gordon Rojas Kirby, Mariana Smit Vega Garcia, and Bridget Eileen Tenner, Pinnacle sets of signed permutations, arXiv:2301.02628 [math.CO] (2023).
Crossrefs
Programs
-
Maple
f:= gfun:-rectoproc({(8+8*n)*a(n)+(4*n+16)*a(1+n)+(-20-6*n)*a(n+2)+(-5-n)*a(n+3)+(5+n)*a(n+4), a(0) = 0, a(1) = 0, a(2) = 1, a(3) = 1}, a(n), remember): map(f, [$0..40]); # Robert Israel, Feb 12 2018
-
Mathematica
f[n_] := 2^(n - 1) + ((1 + (-1)^n)/4) Binomial[n, n/2] - Binomial[n, Floor[n/2]]; Array[f, 38, 0] (* Robert G. Wilson v, Feb 10 2018 *) Table[Length[Select[Tuples[{0,1},{n+1}],First[#]==1&&Count[#,0]>Count[#,1]&]],{n,0,10}] (* Gus Wiseman, Jul 22 2021 *)
Formula
From Robert Israel, Feb 12 2018: (Start)
G.f.: (x+1)*sqrt(1-4*x^2)/(2*x*(4*x^2-1))+(x-1)/(2*(2*x-1)*x).
D-finite with recurrence: (8+8*n)*a(n)+(4*n+16)*a(1+n)+(-20-6*n)*a(n+2)+(-5-n)*a(n+3)+(5+n)*a(n+4) = 0. (End)
A163493 Number of binary strings of length n which have the same number of 00 and 01 substrings.
1, 2, 2, 3, 6, 9, 15, 30, 54, 97, 189, 360, 675, 1304, 2522, 4835, 9358, 18193, 35269, 68568, 133737, 260802, 509132, 995801, 1948931, 3816904, 7483636, 14683721, 28827798, 56637969, 111347879, 219019294, 431043814, 848764585, 1672056525, 3295390800, 6497536449
Offset: 0
Keywords
Comments
A variation of problem 11424 in the American Mathematical Monthly. Terms were brute-force calculated using Maple 10.
Proposed Problem 11610 in the Dec 2011 A.M.M.
From Gus Wiseman, Jul 27 2021: (Start)
Also the antidiagonal sums of the matrices counting integer compositions by length and alternating sum (A345197). So a(n) is the number of integer compositions of n + 1 of length (n - s + 3)/2, where s is the alternating sum of the composition. For example, the a(0) = 1 through a(6) = 7 compositions are:
(1) (2) (3) (4) (5) (6) (7)
(11) (21) (31) (41) (51) (61)
(121) (122) (123) (124)
(221) (222) (223)
(1112) (321) (322)
(1211) (1122) (421)
(1221) (1132)
(2112) (1231)
(2211) (2122)
(2221)
(3112)
(3211)
(11131)
(12121)
(13111)
For a bijection with the main (binary string) interpretation, take the run-lengths of each binary string of length n + 1 that satisfies the condition and starts with 1.
(End)
Examples
1 + 2*x + 2*x^2 + 3*x^3 + 6*x^4 + 9*x^5 + 15*x^6 + 30*x^7 + 54*x^8 + 97*x^9 + ... From _Gus Wiseman_, Jul 27 2021: (Start) The a(0) = 1 though a(6) = 15 binary strings: () (0) (1,0) (0,0,1) (0,0,1,0) (0,0,1,1,0) (0,0,0,1,0,1) (1) (1,1) (1,1,0) (0,0,1,1) (0,0,1,1,1) (0,0,1,0,0,1) (1,1,1) (0,1,0,0) (0,1,1,0,0) (0,0,1,1,1,0) (1,0,0,1) (1,0,0,1,0) (0,0,1,1,1,1) (1,1,1,0) (1,0,0,1,1) (0,1,0,0,0,1) (1,1,1,1) (1,0,1,0,0) (0,1,1,1,0,0) (1,1,0,0,1) (1,0,0,1,1,0) (1,1,1,1,0) (1,0,0,1,1,1) (1,1,1,1,1) (1,0,1,1,0,0) (1,1,0,0,1,0) (1,1,0,0,1,1) (1,1,0,1,0,0) (1,1,1,0,0,1) (1,1,1,1,1,0) (1,1,1,1,1,1) (End)
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..3328 (first 501 terms from R. H. Hardin)
- Shalosh B. Ekhad and Doron Zeilberger, Automatic Solution of Richard Stanley's Amer. Math. Monthly Problem #11610 and ANY Problem of That Type, arXiv preprint arXiv:1112.6207 [math.CO], 2011. See subpages for rigorous derivations of g.f., recurrence, asymptotics for this sequence. [From _N. J. A. Sloane_, Apr 07 2012]
- R. Stanley, Problem 11610, Amer. Math. Monthly, 118 (2011), 937; 120 (2013), 943-944.
Crossrefs
Antidiagonal sums of the matrices A345197.
Row sums of A345907.
Taking diagonal instead of antidiagonal sums gives A345908.
A011782 counts compositions (or binary strings).
A097805 counts compositions by alternating (or reverse-alternating) sum.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
Programs
-
Maple
with(combinat): count := proc(n) local S, matches, A, k, i; S := subsets(\{seq(i, i=1..n)\}): matches := 0: while not S[finished] do A := S[nextvalue](): k := 0: for i from 1 to n-1 do: if not (i in A) and not (i+1 in A) then k := k + 1: fi: if not (i in A) and (i+1 in A) then k := k - 1: fi: od: if (k = 0) then matches := matches + 1: fi: end do; return(matches); end proc: # second Maple program: b:= proc(n, l, t) option remember; `if`(n-abs(t)<0, 0, `if`(n=0, 1, add(b(n-1, i, t+`if`(l=0, (-1)^i, 0)), i=0..1))) end: a:= n-> b(n, 1, 0): seq(a(n), n=0..36); # Alois P. Heinz, Mar 20 2024
-
Mathematica
a[0] = 1; a[n_] := Sum[Binomial[2*k - 1, k]*Binomial[n - 2*k, k] + Binomial[2*k, k]*Binomial[n - 2*k - 1, k], {k, 0, n/3}]; Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Nov 28 2017, after Joel B. Lewis *) Table[Length[Select[Tuples[{0,1},n],Count[Partition[#,2,1],{0,0}]==Count[Partition[#,2,1],{0,1}]&]],{n,0,10}] (* Gus Wiseman, Jul 27 2021 *) a[0]:=1; a[n_]:=(1 + 3*HypergeometricPFQ[{1/2, 1-3*n/8, (1-n)/3, (2-n)/3, -n/3},{1, (1-n)/2, 1-n/2, -3*n/8}, -27])/2; Array[a,37,0] (* Stefano Spezia, Apr 26 2024 *)
-
Python
from math import comb def A163493(n): return 2+sum((x:=comb((k:=m<<1)-1,m)*comb(n-k,m))+(x*(n-3*m)<<1)//(n-k) for m in range(1,n//3+1)) if n else 1 # Chai Wah Wu, May 01 2024
Formula
G.f.: 1/2/(1-x) + (1+2*x)/2/sqrt((1-x)*(1-2*x)*(1+x+2*x^2)). - Richard Stanley, corrected Apr 29 2011
G.f.: (1 + sqrt( 1 + 4*x / ((1 - x) * (1 - 2*x) * (1 + x + 2*x^2)))) / (2*(1 - x)). - Michael Somos, Jan 30 2012
a(n) = sum( binomial(2*k-1, k)*binomial(n-2*k,k) + binomial(2*k, k)*binomial(n-2*k-1, k), k=0..floor(n/3)). - Joel B. Lewis, May 21 2011
Conjecture: -n*a(n) +(2+n)*a(n-1) +(3n-12)*a(n-2) +(12-n)*a(n-3) +(2n-18)*a(n-4)+(56-12n)*a(n-5) +(8n-40)*a(n-6)=0. - R. J. Mathar, Nov 28 2011
G.f. y = A(x) satisfies x = (1 - x) * (1 - 2*x) * (1 + x + 2*x^2) * y * (y * (1 - x) - 1). - Michael Somos, Jan 30 2012
Sequence a(n) satisfies 0 = a(n) * (n^2-2*n) + a(n-1) * (-3*n^2+8*n-2) + a(n-2) * (3*n^2-10*n+2) + a(n-3) * (-5*n^2+18*n-6) + a(n-4) * (8*n^2-34*n+22) + a(n-5) * (-4*n^2+20*n-16) except if n=1 or n=2. - Michael Somos, Jan 30 2012
a(n) = (1 + 3*hypergeom([1/2, 1-3*n/8, (1-n)/3, (2-n)/3, -n/3],[1, (1-n)/2, 1-n/2, -3*n/8],-27))/2 for n > 0. - Stefano Spezia, Apr 26 2024
a(n) ~ 2^n / sqrt(Pi*n). - Vaclav Kotesovec, Apr 26 2024
A345917 Numbers k such that the k-th composition in standard order (row k of A066099) has alternating sum > 0.
1, 2, 4, 5, 7, 8, 9, 11, 14, 16, 17, 18, 19, 21, 22, 23, 26, 28, 29, 31, 32, 33, 34, 35, 37, 38, 39, 42, 44, 45, 47, 52, 56, 57, 59, 62, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 82, 84, 85, 87, 88, 89, 90, 91, 93, 94, 95, 100, 104, 105, 107
Offset: 1
Keywords
Comments
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
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.
Examples
The initial terms and the corresponding compositions: 1: (1) 2: (2) 4: (3) 5: (2,1) 7: (1,1,1) 8: (4) 9: (3,1) 11: (2,1,1) 14: (1,1,2) 16: (5) 17: (4,1) 18: (3,2) 19: (3,1,1) 21: (2,2,1) 22: (2,1,2)
Crossrefs
The version for Heinz numbers of partitions is A026424.
These compositions are counted by A027306.
These are the positions of terms > 0 in A124754.
The weak (k >= 0) version is A345913.
The reverse-alternating version is A345918.
The opposite (k < 0) version is A345919.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A345197 counts compositions by sum, length, and alternating sum.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
Programs
-
Mathematica
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse; ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}]; Select[Range[0,100],ats[stc[#]]>0&]
A345919 Numbers k such that the k-th composition in standard order (row k of A066099) has alternating sum < 0.
6, 12, 20, 24, 25, 27, 30, 40, 48, 49, 51, 54, 60, 72, 80, 81, 83, 86, 92, 96, 97, 98, 99, 101, 102, 103, 106, 108, 109, 111, 116, 120, 121, 123, 126, 144, 160, 161, 163, 166, 172, 184, 192, 193, 194, 195, 197, 198, 199, 202, 204, 205, 207, 212, 216, 217, 219
Offset: 1
Keywords
Comments
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
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.
Examples
The initial terms and the corresponding compositions: 6: (1,2) 81: (2,4,1) 12: (1,3) 83: (2,3,1,1) 20: (2,3) 86: (2,2,1,2) 24: (1,4) 92: (2,1,1,3) 25: (1,3,1) 96: (1,6) 27: (1,2,1,1) 97: (1,5,1) 30: (1,1,1,2) 98: (1,4,2) 40: (2,4) 99: (1,4,1,1) 48: (1,5) 101: (1,3,2,1) 49: (1,4,1) 102: (1,3,1,2) 51: (1,3,1,1) 103: (1,3,1,1,1) 54: (1,2,1,2) 106: (1,2,2,2) 60: (1,1,1,3) 108: (1,2,1,3) 72: (3,4) 109: (1,2,1,2,1) 80: (2,5) 111: (1,2,1,1,1,1)
Crossrefs
The version for Heinz numbers of partitions is A119899.
These are the positions of terms < 0 in A124754.
The complement is A345913.
The weak (k <= 0) version is A345915.
The opposite (k < 0) version is A345917.
The version for reversed alternating sum is A345920.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A236913 counts partitions of 2n with reverse-alternating sum <= 0.
A345197 counts compositions by sum, length, and alternating sum.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
Programs
-
Mathematica
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse; ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}]; Select[Range[0,100],ats[stc[#]]<0&]
A345924 Numbers k such that the k-th composition in standard order (row k of A066099) has alternating sum -2.
12, 40, 49, 51, 54, 60, 144, 161, 163, 166, 172, 184, 194, 197, 199, 202, 205, 207, 212, 217, 219, 222, 232, 241, 243, 246, 252, 544, 577, 579, 582, 588, 600, 624, 642, 645, 647, 650, 653, 655, 660, 665, 667, 670, 680, 689, 691, 694, 700, 720, 737, 739, 742
Offset: 1
Keywords
Comments
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
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.
Examples
The initial terms and the corresponding compositions: 12: (1,3) 202: (1,3,2,2) 582: (3,4,1,2) 40: (2,4) 205: (1,3,1,2,1) 588: (3,3,1,3) 49: (1,4,1) 207: (1,3,1,1,1,1) 600: (3,2,1,4) 51: (1,3,1,1) 212: (1,2,2,3) 624: (3,1,1,5) 54: (1,2,1,2) 217: (1,2,1,3,1) 642: (2,6,2) 60: (1,1,1,3) 219: (1,2,1,2,1,1) 645: (2,5,2,1) 144: (3,5) 222: (1,2,1,1,1,2) 647: (2,5,1,1,1) 161: (2,5,1) 232: (1,1,2,4) 650: (2,4,2,2) 163: (2,4,1,1) 241: (1,1,1,4,1) 653: (2,4,1,2,1) 166: (2,3,1,2) 243: (1,1,1,3,1,1) 655: (2,4,1,1,1,1) 172: (2,2,1,3) 246: (1,1,1,2,1,2) 660: (2,3,2,3) 184: (2,1,1,4) 252: (1,1,1,1,1,3) 665: (2,3,1,3,1) 194: (1,5,2) 544: (4,6) 667: (2,3,1,2,1,1) 197: (1,4,2,1) 577: (3,6,1) 670: (2,3,1,1,1,2) 199: (1,4,1,1,1) 579: (3,5,1,1) 680: (2,2,2,4)
Crossrefs
These compositions are counted by A002054.
These are the positions of -2's in A124754.
The version for reverse-alternating sum is A345923.
The opposite (positive 2) version is A345925.
The version for Heinz numbers of partitions is A345962.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A120452 counts partitions of 2n with reverse-alternating sum 2.
A345197 counts compositions by sum, length, and alternating sum.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
Programs
-
Mathematica
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse; ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}]; Select[Range[0,100],ats[stc[#]]==-2&]
A345918 Numbers k such that the k-th composition in standard order (row k of A066099) has reverse-alternating sum > 0.
1, 2, 4, 6, 7, 8, 11, 12, 14, 16, 19, 20, 21, 22, 24, 26, 27, 28, 30, 31, 32, 35, 37, 38, 40, 42, 44, 47, 48, 51, 52, 54, 56, 59, 60, 62, 64, 67, 69, 70, 72, 73, 74, 76, 79, 80, 82, 83, 84, 86, 87, 88, 91, 92, 93, 94, 96, 99, 100, 101, 102, 104, 106, 107, 108
Offset: 1
Keywords
Comments
The reverse-alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(k-i) y_i.
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.
Examples
The initial terms and the corresponding compositions: 1: (1) 26: (1,2,2) 52: (1,2,3) 2: (2) 27: (1,2,1,1) 54: (1,2,1,2) 4: (3) 28: (1,1,3) 56: (1,1,4) 6: (1,2) 30: (1,1,1,2) 59: (1,1,2,1,1) 7: (1,1,1) 31: (1,1,1,1,1) 60: (1,1,1,3) 8: (4) 32: (6) 62: (1,1,1,1,2) 11: (2,1,1) 35: (4,1,1) 64: (7) 12: (1,3) 37: (3,2,1) 67: (5,1,1) 14: (1,1,2) 38: (3,1,2) 69: (4,2,1) 16: (5) 40: (2,4) 70: (4,1,2) 19: (3,1,1) 42: (2,2,2) 72: (3,4) 20: (2,3) 44: (2,1,3) 73: (3,3,1) 21: (2,2,1) 47: (2,1,1,1,1) 74: (3,2,2) 22: (2,1,2) 48: (1,5) 76: (3,1,3) 24: (1,4) 51: (1,3,1,1) 79: (3,1,1,1,1)
Crossrefs
The version for prime indices is A000037.
These compositions are counted by A027306.
These are the positions of terms > 0 in A344618.
The weak (k >= 0) version is A345914.
The version for unreversed alternating sum is A345917.
The opposite (k < 0) version is A345920.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A236913 counts partitions of 2n with reverse-alternating sum <= 0.
A344610 counts partitions by sum and positive reverse-alternating sum.
A344611 counts partitions of 2n with reverse-alternating sum >= 0.
A345197 counts compositions by sum, length, and alternating sum.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
Programs
-
Mathematica
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse; sats[y_]:=Sum[(-1)^(i-Length[y])*y[[i]],{i,Length[y]}]; Select[Range[0,100],sats[stc[#]]>0&]
A345920 Numbers k such that the k-th composition in standard order (row k of A066099) has reverse-alternating sum < 0.
5, 9, 17, 18, 23, 25, 29, 33, 34, 39, 45, 49, 57, 65, 66, 68, 71, 75, 77, 78, 81, 85, 89, 90, 95, 97, 98, 103, 105, 109, 113, 114, 119, 121, 125, 129, 130, 132, 135, 139, 141, 142, 149, 153, 154, 159, 161, 169, 177, 178, 183, 189, 193, 194, 199, 205, 209, 217
Offset: 1
Keywords
Comments
The reverse-alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(k-i) y_i.
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.
Examples
The initial terms and the corresponding compositions: 5: (2,1) 68: (4,3) 9: (3,1) 71: (4,1,1,1) 17: (4,1) 75: (3,2,1,1) 18: (3,2) 77: (3,1,2,1) 23: (2,1,1,1) 78: (3,1,1,2) 25: (1,3,1) 81: (2,4,1) 29: (1,1,2,1) 85: (2,2,2,1) 33: (5,1) 89: (2,1,3,1) 34: (4,2) 90: (2,1,2,2) 39: (3,1,1,1) 95: (2,1,1,1,1,1) 45: (2,1,2,1) 97: (1,5,1) 49: (1,4,1) 98: (1,4,2) 57: (1,1,3,1) 103: (1,3,1,1,1) 65: (6,1) 105: (1,2,3,1) 66: (5,2) 109: (1,2,1,2,1)
Crossrefs
The version for prime indices is {}.
The version for Heinz numbers of partitions is A119899.
These are the positions of terms < 0 in A344618.
The complement is A345914.
The weak (k <= 0) version is A345916.
The opposite (k > 0) version is A345918.
The version for unreversed alternating sum is A345919.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A236913 counts partitions of 2n with reverse-alternating sum <= 0.
A345197 counts compositions by sum, length, and alternating sum.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
Programs
-
Mathematica
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse; sats[y_]:=Sum[(-1)^(i-Length[y])*y[[i]],{i,Length[y]}]; Select[Range[0,100],sats[stc[#]]<0&]
A345921 Numbers k such that the k-th composition in standard order (row k of A066099) has alternating sum != 0.
1, 2, 4, 5, 6, 7, 8, 9, 11, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 42, 44, 45, 47, 48, 49, 51, 52, 54, 56, 57, 59, 60, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81
Offset: 1
Keywords
Comments
The alternating sum of a sequence (y_1,...,y_k) is Sum_i (-1)^(i-1) y_i.
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.
Also numbers k such that the k-th composition in standard order has reverse-alternating sum != 0.
Examples
The initial terms and the corresponding compositions: 1: (1) 20: (2,3) 35: (4,1,1) 2: (2) 21: (2,2,1) 37: (3,2,1) 4: (3) 22: (2,1,2) 38: (3,1,2) 5: (2,1) 23: (2,1,1,1) 39: (3,1,1,1) 6: (1,2) 24: (1,4) 40: (2,4) 7: (1,1,1) 25: (1,3,1) 42: (2,2,2) 8: (4) 26: (1,2,2) 44: (2,1,3) 9: (3,1) 27: (1,2,1,1) 45: (2,1,2,1) 11: (2,1,1) 28: (1,1,3) 47: (2,1,1,1,1) 12: (1,3) 29: (1,1,2,1) 48: (1,5) 14: (1,1,2) 30: (1,1,1,2) 49: (1,4,1) 16: (5) 31: (1,1,1,1,1) 51: (1,3,1,1) 17: (4,1) 32: (6) 52: (1,2,3) 18: (3,2) 33: (5,1) 54: (1,2,1,2) 19: (3,1,1) 34: (4,2) 56: (1,1,4)
Crossrefs
The version for Heinz numbers of partitions is A000037.
These compositions are counted by A058622.
These are the positions of terms != 0 in A124754.
The complement (k = 0) is A344619.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A345197 counts compositions by sum, length, and alternating sum.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
Programs
-
Mathematica
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse; ats[y_]:=Sum[(-1)^(i-1)*y[[i]],{i,Length[y]}]; Select[Range[0,100],ats[stc[#]]!=0&]
Comments
Examples
References
Links
Crossrefs
Programs
Maple
Mathematica
PARI
PARI
PARI
Python
Sage
Formula
Extensions