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.

Showing 1-10 of 13 results. Next

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.

Original entry on oeis.org

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

Views

Author

Paul Barry, Aug 25 2004

Keywords

Comments

Previous name was: Riordan array (1, 1/(1-x)) read by rows.
Note this Riordan array would be denoted (1, x/(1-x)) by some authors.
Columns have g.f. (x/(1-x))^k. Reverse of A071919. Row sums are A011782. Antidiagonal sums are Fibonacci(n-1). Inverse as Riordan array is (1, 1/(1+x)). A097805=B*A059260*B^(-1), where B is the binomial matrix.
(0,1)-Pascal triangle. - Philippe Deléham, Nov 21 2006
(n+1) * each term of row n generates triangle A127952: (1; 0, 2; 0, 3, 3; 0, 4, 8, 4; ...). - Gary W. Adamson, Feb 09 2007
Triangle T(n,k), 0<=k<=n, read by rows, given by [0,1,0,0,0,0,0,...] DELTA [1,0,0,0,0,0,0,...] where DELTA is the operator defined in A084938. - Philippe Deléham, Dec 12 2008
From Paul Weisenhorn, Feb 09 2011: (Start)
Triangle read by rows: T(r,c) is the number of unordered partitions of n=r*(r+1)/2+c into (r+1) parts < (r+1) and at most pairs of equal parts and parts in neighboring pairs have difference 2.
Triangle read by rows: T(r,c) is the number of unordered partitions of the number n=r*(r+1)/2+(c-1) into r parts < (r+1) and at most pairs of equal parts and parts in neighboring pairs have difference 2. (End)
Triangle read by rows: T(r,c) is the number of ordered partitions (compositions) of r into c parts. - Juergen Will, Jan 04 2016
From Tom Copeland, Oct 25 2012: (Start)
Given a basis composed of a sequence of polynomials p_n(x) characterized by ladder (creation / annihilation, or raising / lowering) operators defined by R p_n(x) = p_(n+1)(x) and L p_n(x) = n p_(n-1)(x) with p_0(x)=1, giving the number operator # p_n(x) = RL p_n(x) = n p_n(x), the lower triangular padded Pascal matrix Pd (A097805) serves as a matrix representation of the operator exp(R^2*L) = exp(R#) =
1) exp(x^2D) for the set x^n and
2) D^(-1) exp(t*x)D for the set x^n/n! (see A218234).
(End)
From James East, Apr 11 2014: (Start)
Square array a(m,n) with m,n=0,1,2,... read by off-diagonals.
a(m,n) gives the number of order-preserving functions f:{1,...,m}->{1,...,n}. Order-preserving means that x
a(n,n)=A088218(n) is the size of the semigroup O_n of all order-preserving transformations of {1,...,n}.
Read as a triangle, this sequence may be obtained by augmenting Pascal's triangle by appending the column 1,0,0,0,... on the left.
(End)
A formula based on the partitions of n with largest part k is given as a Sage program below. The 'conjugate' formula leads to A048004. - Peter Luschny, Jul 13 2015
From Wolfdieter Lang, Feb 17 2017: (Start)
The transposed of this lower triangular Riordan matrix of the associated type T provides the transition matrix between the monomial basis {x^n}, n >= 0, and the basis {y^n}, n >= 0, with y = x/(1-x): x^0 = 1 = y^0, x^n = Sum_{m >= n} Ttrans(n,m) y^m, for n >= 1, with Ttrans(n,m) = binomial(m-1,n-1).
Therefore, if a transformation with this Riordan matrix from a sequence {a} to the sequence {b} is given by b(n) = Sum_{m=0..n} T(n, m)*a(m), with T(n, m) = binomial(n-1, m-1), for n >= 1, then Sum_{n >= 0} a(n)*x^n = Sum_{n >= 0} b(n)*y^n, with y = x/(1-x) and vice versa. This is a modified binomial transformation; the usual one belongs to the Pascal Riordan matrix A007318. (End)
From Gus Wiseman, Jan 23 2022: (Start)
Also the number of compositions of n with alternating sum k, with k ranging from -n to n in steps of 2. For example, row n = 6 counts the following compositions (empty column indicated by dot):
. (15) (24) (33) (42) (51) (6)
(141) (132) (123) (114)
(1113) (231) (222) (213)
(1212) (1122) (321) (312)
(1311) (1221) (1131) (411)
(2112) (2121)
(2211) (3111)
(11121) (11112)
(12111) (11211)
(111111) (21111)
The reverse-alternating version is the same. Counting compositions by all three parameters (sum, length, alternating sum) gives A345197. Compositions of 2n with alternating sum 2k with k ranging from -n + 1 to n are A034871. (End)
Also the convolution triangle of A000012. - Peter Luschny, Oct 07 2022
From Sergey Kitaev, Nov 18 2023: (Start)
Number of permutations of length n avoiding simultaneously the patterns 123 and 132 with k right-to-left maxima. A right-to-left maximum in a permutation a(1)a(2)...a(n) is position i such that a(j) < a(i) for all i < j.
Number of permutations of length n avoiding simultaneously the patterns 231 and 312 with k right-to-left minima (resp., left-to-right maxima). A right-to-left minimum (resp., left-to-right maximum) in a permutation a(1)a(2)...a(n) is position i such that a(j) > a(i) for all j > i (resp., a(j) < a(i) for all j < i).
Number of permutations of length n avoiding simultaneously the patterns 213 and 312 with k right-to-left maxima (resp., left-to-right maxima).
Number of permutations of length n avoiding simultaneously the patterns 213 and 231 with k right-to-left maxima (resp., right-to-left minima). (End)

Examples

			G.f. = 1 + x * (x + x^3 * (1 + x) + x^6 * (1 + x)^2 + x^10 * (1 + x)^3 + ...). - _Michael Somos_, Aug 20 2006
The triangle T(n, k) begins:
n\k  0 1 2  3  4   5   6  7  8 9 10 ...
0:   1
1:   0 1
2:   0 1 1
3:   0 1 2  1
4:   0 1 3  3  1
5:   0 1 4  6  4   1
6:   0 1 5 10 10   5   1
7:   0 1 6 15 20  15   6  1
8:   0 1 7 21 35  35  21  7  1
9:   0 1 8 28 56  70  56 28  8 1
10:  0 1 9 36 84 126 126 84 36 9  1
... reformatted _Wolfdieter Lang_, Jul 31 2017
From _Paul Weisenhorn_, Feb 09 2011: (Start)
T(r=5,c=3) = binomial(4,2) = 6 unordered partitions of the number n = r*(r+1)/2+c = 18 with (r+1)=6 summands: (5+5+4+2+1+1), (5+5+3+3+1+1), (5+4+4+3+1+1), (5+5+3+2+2+1), (5+4+4+2+2+1), (5+4+3+3+2+1).
T(r=5,c=3) = binomial(4,2) = 6 unordered partitions of the number n = r*(r+1)/2+(c-1) = 17 with r=5 summands: (5+5+4+2+1), (5+5+3+3+1), (5+5+3+2+2), (5+4+4+3+1), (5+4+4+2+2), (5+4+3+3+2).  (End)
From _James East_, Apr 11 2014: (Start)
a(0,0)=1 since there is a unique (order-preserving) function {}->{}.
a(m,0)=0 for m>0 since there is no function from a nonempty set to the empty set.
a(3,2)=4 because there are four order-preserving functions {1,2,3}->{1,2}: these are [1,1,1], [2,2,2], [1,1,2], [1,2,2]. Here f=[a,b,c] denotes the function defined by f(1)=a, f(2)=b, f(3)=c.
a(2,3)=6 because there are six order-preserving functions {1,2}->{1,2,3}: these are [1,1], [1,2], [1,3], [2,2], [2,3], [3,3].
(End)
		

References

  • D. E. Knuth, The Art of Computer Programming, vol. 4A, Combinatorial Algorithms, Part 1, Section 7.2.1.3, 2011.

Crossrefs

Case m=0 of the polynomials defined in A278073.
Cf. A000012 (diagonal), A011782 (row sums), A088218 (central terms).
The terms just left of center in odd-indexed rows are A001791, even A002054.
The odd-indexed rows are A034871.
Row sums without the center are A058622.
The unordered version is A072233, without zeros A008284.
Right half without center has row sums A027306(n-1).
Right half with center has row sums A116406(n).
Left half without center has row sums A294175(n-1).
Left half with center has row sums A058622(n-1).
A025047 counts alternating compositions.
A098124 counts balanced compositions, unordered A047993.
A106356 counts compositions by number of maximal anti-runs.
A344651 counts partitions by sum and alternating sum.
A345197 counts compositions by sum, length, and alternating sum.

Programs

  • Maple
    b:= proc(n, i, p) option remember; `if`(n=0, p!, `if`(i<1, 0,
          expand(add(b(n-i*j, i-1, p+j)/j!*x^j, j=0..n/i))))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n$2, 0)):
    seq(T(n), n=0..20);  # Alois P. Heinz, May 25 2014
    # Alternatively:
    T := proc(k,n) option remember;
    if k=n then 1 elif k=0 then 0 else
    add(T(k-1,n-i), i=1..n-k+1) fi end:
    A097805 := (n,k) -> T(k,n):
    for n from 0 to 12 do seq(A097805(n,k), k=0..n) od; # Peter Luschny, Mar 12 2016
    # Uses function PMatrix from A357368.
    PMatrix(10, n -> 1);  # Peter Luschny, Oct 07 2022
  • Mathematica
    T[0, 0] = 1; T[n_, k_] := Binomial[n-1, k-1]; Table[T[n, k], {n, 0, 12}, {k, 0, n}] // Flatten (* Jean-François Alcover, Sep 03 2014, after Paul Weisenhorn *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[#]==k&]],{n,0,10},{k,0,n}] (* Gus Wiseman, Jan 23 2022 *)
  • PARI
    {a(n) = my(m); if( n<2, n==0, n--; m = (sqrtint(8*n + 1) - 1)\2; binomial(m-1, n - m*(m + 1)/2))}; /* Michael Somos, Aug 20 2006 */
    
  • PARI
    T(n,k) = if (k==0, 0^n, binomial(n-1, k-1)); \\ Michel Marcus, May 06 2022
    
  • PARI
    row(n) = vector(n+1, k, k--; if (k==0, 0^n, binomial(n-1, k-1))); \\ Michel Marcus, May 06 2022
    
  • Python
    from math import comb
    def T(n, k): return comb(n-1, k-1) if k != 0 else k**n  # Peter Luschny, May 06 2022
  • Sage
    # Illustrates a basic partition formula, is not efficient as a program for large n.
    def A097805_row(n):
        r = []
        for k in (0..n):
            s = 0
            for q in Partitions(n, max_part=k, inner=[k]):
                s += mul(binomial(q[j],q[j+1]) for j in range(len(q)-1))
            r.append(s)
        return r
    [A097805_row(n) for n in (0..9)] # Peter Luschny, Jul 13 2015
    

Formula

Number triangle T(n, k) defined by T(n,k) = Sum_{j=0..n} binomial(n, j)*if(k<=j, (-1)^(j-k), 0).
T(r,c) = binomial(r-1,c-1), 0 <= c <= r. - Paul Weisenhorn, Feb 09 2011
G.f.: (-1+x)/(-1+x+x*y). - R. J. Mathar, Aug 11 2015
a(0,0) = 1, a(n,k) = binomial(n-1,n-k) = binomial(n-1,k-1) Juergen Will, Jan 04 2016
G.f.: (x^1 + x^2 + x^3 + ...)^k = (x/(1-x))^k. - Juergen Will, Jan 04 2016
From Tom Copeland, Nov 15 2016: (Start)
E.g.f.: 1 + x*[e^((x+1)t)-1]/(x+1).
This padded Pascal matrix with the odd columns negated is NpdP = M*S = S^(-1)*M^(-1) = S^(-1)*M, where M(n,k) = (-1)^n A130595(n,k), the inverse Pascal matrix with the odd rows negated, S is the summation matrix A000012, the lower triangular matrix with all elements unity, and S^(-1) = A167374, a finite difference matrix. NpdP is self-inverse, i.e., (M*S)^2 = the identity matrix, and has the e.g.f. 1 - x*[e^((1-x)t)-1]/(1-x).
M = NpdP*S^(-1) follows from the well-known recursion property of the Pascal matrix, implying NpdP = M*S.
The self-inverse property of -NpdP is implied by the self-inverse relation of its embedded signed Pascal submatrix M (cf. A130595). Also see A118800 for another proof.
Let P^(-1) be A130595, the inverse Pascal matrix. Then T = A200139*P^(-1) and T^(-1) = padded P^(-1) = P*A097808*P^(-1). (End)
The center (n>0) is T(2n+1,n+1) = A000984(n) = 2*A001700(n-1) = 2*A088218(n) = A126869(2n) = 2*A138364(2n-1). - Gus Wiseman, Jan 25 2022

Extensions

Corrected by Philippe Deléham, Oct 05 2005
New name using classical terminology by Peter Luschny, Feb 05 2019

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.

Original entry on oeis.org

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

Author

Gus Wiseman, Jul 03 2021

Keywords

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
		

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.
A000041 counts partitions of 2n with alternating sum 0, ranked by A000290.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A316524 gives the alternating sum of prime indices (reverse: A344616).
A344610 counts partitions by sum and positive reverse-alternating sum.
A344611 counts partitions of 2n with reverse-alternating sum >= 0.
Other tetrangles: A318393, A318816, A320808, A321912.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
- k = 0: counted by A088218, ranked by A344619/A344619.
- k = 1: counted by A000984, ranked by A345909/A345911.
- k = -1: counted by A001791, ranked by A345910/A345912.
- k = 2: counted by A088218, ranked by A345925/A345922.
- k = -2: counted by A002054, ranked by A345924/A345923.
- k >= 0: counted by A116406, ranked by A345913/A345914.
- k <= 0: counted by A058622(n-1), ranked by A345915/A345916.
- k > 0: counted by A027306, ranked by A345917/A345918.
- k < 0: counted by A294175, ranked by A345919/A345920.
- k != 0: counted by A058622, ranked by A345921/A345921.
- k even: counted by A081294, ranked by A053754/A053754.
- k odd: counted by A000302, ranked by A053738/A053738.

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)).

Original entry on oeis.org

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

Author

Enrique Navarrete, Feb 10 2018

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}.
		

Crossrefs

The even bisection is A000346.
The odd bisection is A008549.
The following relate to compositions of n + 1 with alternating sum k < 0.
- The k = 1 version is A000984, ranked by A345909/A345911.
- The opposite (k > 0) version is A027306, ranked by A345917/A345918.
- The weak (k <= 0) version A058622, ranked by A345915/A345916.
- The k != 0 version is also A058622, ranked by A345921.
- The complement (k >= 0) is counted by A116406, ranked by A345913/A345914.
- The k = 0 version is A138364, ranked by A344619.
- The unordered version is A344608, ranked by A119899.
- Ranked by A345919 (reverse: A345920).
A097805 counts compositions by alternating (or reverse-alternating) sum.
A101211 lists run-lengths in binary expansion (reverse: A227736).
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A345197 counts compositions by length and alternating sum.

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.

Original entry on oeis.org

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

Author

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)
		

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.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A316524 gives the alternating sum of prime indices (reverse: A344616).
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
- k = 0: counted by A088218, ranked by A344619/A344619.
- k = 1: counted by A000984, ranked by A345909/A345911.
- k = -1: counted by A001791, ranked by A345910/A345912.
- k = 2: counted by A088218, ranked by A345925/A345922.
- k = -2: counted by A002054, ranked by A345924/A345923.
- k >= 0: counted by A116406, ranked by A345913/A345914.
- k <= 0: counted by A058622(n-1), ranked by A345915/A345916.
- k > 0: counted by A027306, ranked by A345917/A345918.
- k < 0: counted by A294175, ranked by A345919/A345920.
- k != 0: counted by A058622, ranked by A345921/A345921.
- k even: counted by A081294, ranked by A053754/A053754.
- k odd: counted by A000302, ranked by A053738/A053738.

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.

Original entry on oeis.org

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

Author

Gus Wiseman, Jul 08 2021

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.
A000041 counts partitions of 2n with alternating sum 0, ranked by A000290.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A316524 gives the alternating sum of prime indices (reverse: A344616).
A345197 counts compositions by sum, length, and alternating sum.
Standard compositions: A000120, A066099, A070939, A228351, A124754, A344618.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
- k = 0: counted by A088218, ranked by A344619/A344619.
- k = 1: counted by A000984, ranked by A345909/A345911.
- k = -1: counted by A001791, ranked by A345910/A345912.
- k = 2: counted by A088218, ranked by A345925/A345922.
- k = -2: counted by A002054, ranked by A345924/A345923.
- k >= 0: counted by A116406, ranked by A345913/A345914.
- k <= 0: counted by A058622(n-1), ranked by A345915/A345916.
- k > 0: counted by A027306, ranked by A345917/A345918.
- k < 0: counted by A294175, ranked by A345919/A345920.
- k != 0: counted by A058622, ranked by A345921/A345921.
- k even: counted by A081294, ranked by A053754/A053754.
- k odd: counted by A000302, ranked by A053738/A053738.

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.

Original entry on oeis.org

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

Author

Gus Wiseman, Jul 09 2021

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.
These compositions are counted by A294175 (even bisection: A008549).
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.
A000041 counts partitions of 2n with alternating sum 0, ranked by A000290.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A236913 counts partitions of 2n with reverse-alternating sum <= 0.
A316524 gives the alternating sum of prime indices (reverse: A344616).
A345197 counts compositions by sum, length, and alternating sum.
Standard compositions: A000120, A066099, A070939, A228351, A124754, A344618.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
- k = 0: counted by A088218, ranked by A344619/A344619.
- k = 1: counted by A000984, ranked by A345909/A345911.
- k = -1: counted by A001791, ranked by A345910/A345912.
- k = 2: counted by A088218, ranked by A345925/A345922.
- k = -2: counted by A002054, ranked by A345924/A345923.
- k >= 0: counted by A116406, ranked by A345913/A345914.
- k <= 0: counted by A058622(n-1), ranked by A345915/A345916.
- k > 0: counted by A027306, ranked by A345917/A345918.
- k < 0: counted by A294175, ranked by A345919/A345920.
- k != 0: counted by A058622, ranked by A345921/A345921.
- k even: counted by A081294, ranked by A053754/A053754.
- k odd: counted by A000302, ranked by A053738/A053738.

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.

Original entry on oeis.org

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

Author

Gus Wiseman, Jul 11 2021

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.
A000041 counts partitions of 2n with alternating sum 0, ranked by A000290.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A120452 counts partitions of 2n with reverse-alternating sum 2.
A316524 gives the alternating sum of prime indices (reverse: A344616).
A345197 counts compositions by sum, length, and alternating sum.
Standard compositions: A000120, A066099, A070939, A228351, A124754, A344618.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
- k = 0: counted by A088218, ranked by A344619/A344619.
- k = 1: counted by A000984, ranked by A345909/A345911.
- k = -1: counted by A001791, ranked by A345910/A345912.
- k = 2: counted by A088218, ranked by A345925/A345922.
- k = -2: counted by A002054, ranked by A345924/A345923.
- k >= 0: counted by A116406, ranked by A345913/A345914.
- k <= 0: counted by A058622(n-1), ranked by A345915/A345916.
- k > 0: counted by A027306, ranked by A345917/A345918.
- k < 0: counted by A294175, ranked by A345919/A345920.
- k != 0: counted by A058622, ranked by A345921/A345921.
- k even: counted by A081294, ranked by A053754/A053754.
- k odd: counted by A000302, ranked by A053738/A053738.

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.

Original entry on oeis.org

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

Author

Gus Wiseman, Jul 09 2021

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.
The version for Heinz numbers of partitions is A026424, counted by A027193.
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.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A236913 counts partitions of 2n with reverse-alternating sum <= 0.
A316524 gives the alternating sum of prime indices (reverse: A344616).
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.
Standard compositions: A000120, A066099, A070939, A228351, A124754, A344618.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
- k = 0: counted by A088218, ranked by A344619/A344619.
- k = 1: counted by A000984, ranked by A345909/A345911.
- k = -1: counted by A001791, ranked by A345910/A345912.
- k = 2: counted by A088218, ranked by A345925/A345922.
- k = -2: counted by A002054, ranked by A345924/A345923.
- k >= 0: counted by A116406, ranked by A345913/A345914.
- k <= 0: counted by A058622(n-1), ranked by A345915/A345916.
- k > 0: counted by A027306, ranked by A345917/A345918.
- k < 0: counted by A294175, ranked by A345919/A345920.
- k != 0: counted by A058622, ranked by A345921/A345921.
- k even: counted by A081294, ranked by A053754/A053754.
- k odd: counted by A000302, ranked by A053738/A053738.

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.

Original entry on oeis.org

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

Author

Gus Wiseman, Jul 09 2021

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 compositions are counted by A294175 (even bisection: A008549).
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.
A000041 counts partitions of 2n with alternating sum 0, ranked by A000290.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A236913 counts partitions of 2n with reverse-alternating sum <= 0.
A316524 gives the alternating sum of prime indices (reverse: A344616).
A345197 counts compositions by sum, length, and alternating sum.
Standard compositions: A000120, A066099, A070939, A228351, A124754, A344618.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
- k = 0: counted by A088218, ranked by A344619/A344619.
- k = 1: counted by A000984, ranked by A345909/A345911.
- k = -1: counted by A001791, ranked by A345910/A345912.
- k = 2: counted by A088218, ranked by A345925/A345922.
- k = -2: counted by A002054, ranked by A345924/A345923.
- k >= 0: counted by A116406, ranked by A345913/A345914.
- k <= 0: counted by A058622(n-1), ranked by A345915/A345916.
- k > 0: counted by A027306, ranked by A345917/A345918.
- k < 0: counted by A294175, ranked by A345919/A345920.
- k != 0: counted by A058622, ranked by A345921/A345921.
- k even: counted by A081294, ranked by A053754/A053754.
- k odd: counted by A000302, ranked by A053738/A053738.

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.

Original entry on oeis.org

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

Author

Gus Wiseman, Jul 10 2021

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.
The positive (k > 0) version is A345917 (reverse: A345918).
The negative (k < 0) version is A345919 (reverse: A345920).
A000041 counts partitions of 2n with alternating sum 0, ranked by A000290.
A011782 counts compositions.
A097805 counts compositions by alternating (or reverse-alternating) sum.
A103919 counts partitions by sum and alternating sum (reverse: A344612).
A316524 gives the alternating sum of prime indices (reverse: A344616).
A345197 counts compositions by sum, length, and alternating sum.
Standard compositions: A000120, A066099, A070939, A228351, A124754, A344618.
Compositions of n, 2n, or 2n+1 with alternating/reverse-alternating sum k:
- k = 0: counted by A088218, ranked by A344619/A344619.
- k = 1: counted by A000984, ranked by A345909/A345911.
- k = -1: counted by A001791, ranked by A345910/A345912.
- k = 2: counted by A088218, ranked by A345925/A345922.
- k = -2: counted by A002054, ranked by A345924/A345923.
- k >= 0: counted by A116406, ranked by A345913/A345914.
- k <= 0: counted by A058622(n-1), ranked by A345915/A345916.
- k > 0: counted by A027306, ranked by A345917/A345918.
- k < 0: counted by A294175, ranked by A345919/A345920.
- k != 0: counted by A058622, ranked by A345921/A345921.
- k even: counted by A081294, ranked by A053754/A053754.
- k odd: counted by A000302, ranked by A053738/A053738.

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&]
Showing 1-10 of 13 results. Next