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 10 results.

A357136 Triangle read by rows where T(n,k) is the number of integer compositions of n with alternating sum k = 0..n. Part of the full triangle A097805.

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 0, 2, 0, 1, 3, 0, 3, 0, 1, 0, 6, 0, 4, 0, 1, 10, 0, 10, 0, 5, 0, 1, 0, 20, 0, 15, 0, 6, 0, 1, 35, 0, 35, 0, 21, 0, 7, 0, 1, 0, 70, 0, 56, 0, 28, 0, 8, 0, 1, 126, 0, 126, 0, 84, 0, 36, 0, 9, 0, 1, 0, 252, 0, 210, 0, 120, 0, 45, 0, 10, 0, 1
Offset: 0

Views

Author

Gus Wiseman, Sep 30 2022

Keywords

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.

Examples

			Triangle begins:
    1
    0   1
    1   0   1
    0   2   0   1
    3   0   3   0   1
    0   6   0   4   0   1
   10   0  10   0   5   0   1
    0  20   0  15   0   6   0   1
   35   0  35   0  21   0   7   0   1
    0  70   0  56   0  28   0   8   0   1
  126   0 126   0  84   0  36   0   9   0   1
    0 252   0 210   0 120   0  45   0  10   0   1
  462   0 462   0 330   0 165   0  55   0  11   0   1
    0 924   0 792   0 495   0 220   0  66   0  12   0   1
For example, row n = 5 counts the following compositions:
  .  (32)     .  (41)   .  (5)
     (122)       (113)
     (221)       (212)
     (1121)      (311)
     (2111)
     (11111)
		

Crossrefs

The full triangle counting compositions by alternating sum is A097805.
The version for partitions is A103919, full triangle A344651.
This is the right-half of even-indexed rows of A260492.
The triangle without top row and left column is A108044.
Ranking and counting compositions:
- product = sum: A335404, counted by A335405.
- sum = twice alternating sum: A348614, counted by A262977.
- length = alternating sum: A357184, counted by A357182.
- length = absolute value of alternating sum: A357185, counted by A357183.
A003242 counts anti-run compositions, ranked by A333489.
A011782 counts compositions.
A025047 counts alternating compositions, ranked by A345167.
A032020 counts strict compositions, ranked by A233564.
A124754 gives alternating sums of standard compositions.
A238279 counts compositions by sum and number of maximal runs.

Programs

  • Mathematica
    Prepend[Table[If[EvenQ[nn],Prepend[#,0],#]&[Riffle[Table[Binomial[nn,k],{k,Floor[nn/2],nn}],0]],{nn,0,10}],{1}]

A357621 Half-alternating sum of the n-th composition in standard order.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 1, 4, 4, 4, 2, 4, 2, 0, 0, 5, 5, 5, 3, 5, 3, 1, 1, 5, 3, 1, 1, -1, -1, -1, 1, 6, 6, 6, 4, 6, 4, 2, 2, 6, 4, 2, 2, 0, 0, 0, 2, 6, 4, 2, 2, 0, 0, 0, 2, -2, -2, -2, 0, -2, 0, 2, 2, 7, 7, 7, 5, 7, 5, 3, 3, 7, 5, 3, 3, 1, 1, 1, 3, 7, 5, 3, 3, 1
Offset: 0

Views

Author

Gus Wiseman, Oct 07 2022

Keywords

Comments

We define the half-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A + B - C - D + E + F - G - ...
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 358-th composition is (2,1,3,1,2) so a(358) = 2 + 1 - 3 - 1 + 2 = 1.
		

Crossrefs

See link for sequences related to standard compositions.
The reverse version is A357622.
The skew-alternating form is A357623, reverse A357624.
Positions of zeros are A357625, reverse A357626.
The version for prime indices is A357629.
The version for Heinz numbers of partitions is A357633.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    halfats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[i/2]),{i,Length[f]}];
    Table[halfats[stc[n]],{n,0,100}]

Formula

Positions of first appearances are powers of 2 and even powers of 2 times 7, or A029746 without 7.

A357623 Skew-alternating sum of the n-th composition in standard order.

Original entry on oeis.org

0, 1, 2, 0, 3, 1, -1, -1, 4, 2, 0, 0, -2, -2, -2, 0, 5, 3, 1, 1, -1, -1, -1, 1, -3, -3, -3, -1, -3, -1, 1, 1, 6, 4, 2, 2, 0, 0, 0, 2, -2, -2, -2, 0, -2, 0, 2, 2, -4, -4, -4, -2, -4, -2, 0, 0, -4, -2, 0, 0, 2, 2, 2, 0, 7, 5, 3, 3, 1, 1, 1, 3, -1, -1, -1, 1, -1
Offset: 0

Views

Author

Gus Wiseman, Oct 08 2022

Keywords

Comments

We define the skew-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A - B - C + D + E - F - G + ....
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 358-th composition is (2,1,3,1,2) so a(358) = 2 - 1 - 3 + 1 + 2 = 1.
		

Crossrefs

See link for sequences related to standard compositions.
Positions of positive firsts appear to be A029744.
The half-alternating form is A357621, reverse A357622.
The reverse version is A357624.
Positions of zeros are A357627, reverse A357628.
The version for prime indices is A357630.
The version for Heinz numbers of partitions is A357634.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    skats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[(i+1)/2]),{i,Length[f]}];
    Table[skats[stc[n]],{n,0,100}]

A357625 Numbers k such that the k-th composition in standard order has half-alternating sum 0.

Original entry on oeis.org

0, 14, 15, 44, 45, 46, 52, 53, 54, 59, 61, 152, 153, 154, 156, 168, 169, 170, 172, 179, 181, 185, 200, 201, 202, 204, 211, 213, 217, 230, 231, 234, 235, 239, 242, 243, 247, 254, 255, 560, 561, 562, 564, 568, 592, 593, 594, 596, 600, 611, 613, 617, 625, 656
Offset: 1

Views

Author

Gus Wiseman, Oct 08 2022

Keywords

Comments

We define the half-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A + B - C - D + E + F - G - ...
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 sequence together with the corresponding compositions begins:
    0: ()
   14: (1,1,2)
   15: (1,1,1,1)
   44: (2,1,3)
   45: (2,1,2,1)
   46: (2,1,1,2)
   52: (1,2,3)
   53: (1,2,2,1)
   54: (1,2,1,2)
   59: (1,1,2,1,1)
   61: (1,1,1,2,1)
		

Crossrefs

See link for sequences related to standard compositions.
The version for full alternating sum is A344619.
Positions of zeros in A357621.
The reverse version is A357626.
The skew-alternating form is A357627, reverse A357628.
The version for prime indices is A357631.
The version for Heinz numbers of partitions is A357635.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    halfats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[i/2]),{i,Length[f]}];
    Select[Range[0,100],halfats[stc[#]]==0&]
  • Python
    from itertools import count, islice
    def comp(n): #row n of A066099 after Franklin T. Adams-Watters
        v,k = [],0
        while n > 0:
            k += 1
            if n%2 == 1:
                v.append(k)
                k = 0
            n = n//2
        return(v[::-1])
    def a_gen():
        for n in count(0):
            c = comp(n)
            x = sum(c[i]*(-1)**(i//2) for i in range(len(c)))
            if x == 0:
                yield(n)
    A357625_list = list(islice(a_gen(), 60)) # John Tyler Rascoe, Jun 01 2024

A357626 Numbers k such that the reversed k-th composition in standard order has half-alternating sum 0.

Original entry on oeis.org

0, 11, 15, 37, 38, 45, 46, 53, 54, 55, 59, 137, 138, 140, 153, 154, 156, 167, 169, 170, 171, 172, 179, 191, 201, 202, 204, 205, 206, 213, 214, 229, 230, 231, 235, 243, 247, 251, 255, 529, 530, 532, 536, 561, 562, 564, 568, 583, 587, 593, 594, 595, 596, 600
Offset: 1

Views

Author

Gus Wiseman, Oct 08 2022

Keywords

Comments

We define the half-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A + B - C - D + E + F - G - ...
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 sequence together with the corresponding compositions begins:
    0: ()
   11: (2,1,1)
   15: (1,1,1,1)
   37: (3,2,1)
   38: (3,1,2)
   45: (2,1,2,1)
   46: (2,1,1,2)
   53: (1,2,2,1)
   54: (1,2,1,2)
   55: (1,2,1,1,1)
   59: (1,1,2,1,1)
		

Crossrefs

See link for sequences related to standard compositions.
The alternating form is A344619.
Positions of zeros in A357622.
The non-reverse version is A357625.
The skew-alternating form is A357628, reverse A357627.
The version for prime indices is A357631.
The version for Heinz numbers of partitions is A357635.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    halfats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[i/2]),{i,Length[f]}];
    Select[Range[0,100],halfats[Reverse[stc[#]]]==0&]

A357183 Number of integer compositions with the same length as the absolute value of their alternating sum.

Original entry on oeis.org

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
Offset: 0

Views

Author

Gus Wiseman, Sep 28 2022

Keywords

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.

Examples

			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)
		

Crossrefs

For product instead of length we have A114220.
For sum equal to twice alternating sum we have A262977, ranked by A348614.
For product equal to sum we have A335405, ranked by A335404.
This is the absolute value version of A357182.
These compositions are ranked by A357185.
The case of partitions is A357189.
A003242 counts anti-run compositions, ranked by A333489.
A011782 counts compositions.
A025047 counts alternating compositions, ranked by A345167.
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.

Programs

  • 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}]

Extensions

a(21)-a(39) from Alois P. Heinz, Sep 29 2022

A357622 Half-alternating sum of the reversed n-th composition in standard order.

Original entry on oeis.org

0, 1, 2, 2, 3, 3, 3, 1, 4, 4, 4, 0, 4, 2, 2, 0, 5, 5, 5, -1, 5, 1, 1, -1, 5, 3, 3, -1, 3, 1, 1, 1, 6, 6, 6, -2, 6, 0, 0, -2, 6, 2, 2, -2, 2, 0, 0, 2, 6, 4, 4, -2, 4, 0, 0, 0, 4, 2, 2, 0, 2, 2, 2, 2, 7, 7, 7, -3, 7, -1, -1, -3, 7, 1, 1, -3, 1, -1, -1, 3, 7, 3
Offset: 0

Views

Author

Gus Wiseman, Oct 08 2022

Keywords

Comments

We define the half-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A + B - C - D + E + F - G - ...
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 357-th composition is (2,1,3,2,1) so a(357) = 1 + 2 - 3 - 1 + 2 = 1.
		

Crossrefs

See link for sequences related to standard compositions.
This is the reverse version of A357621.
The skew-alternating form is A357624, non-reverse A357623.
Positions of zeros are A357626, reverse A357625.
The version for prime indices is A357629.
The version for Heinz numbers of partitions is A357633.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    halfats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[i/2]),{i,Length[f]}];
    Table[halfats[Reverse[stc[n]]],{n,0,100}]

A357627 Numbers k such that the k-th composition in standard order has skew-alternating sum 0.

Original entry on oeis.org

0, 3, 10, 11, 15, 36, 37, 38, 43, 45, 54, 55, 58, 59, 63, 136, 137, 138, 140, 147, 149, 153, 166, 167, 170, 171, 175, 178, 179, 183, 190, 191, 204, 205, 206, 212, 213, 214, 219, 221, 228, 229, 230, 235, 237, 246, 247, 250, 251, 255, 528, 529, 530, 532, 536
Offset: 1

Views

Author

Gus Wiseman, Oct 08 2022

Keywords

Comments

We define the skew-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A - B - C + D + E - F - G + ....
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 sequence together with the corresponding compositions begins:
    0: ()
    3: (1,1)
   10: (2,2)
   11: (2,1,1)
   15: (1,1,1,1)
   36: (3,3)
   37: (3,2,1)
   38: (3,1,2)
   43: (2,2,1,1)
   45: (2,1,2,1)
   54: (1,2,1,2)
   55: (1,2,1,1,1)
   58: (1,1,2,2)
   59: (1,1,2,1,1)
   63: (1,1,1,1,1,1)
		

Crossrefs

See link for sequences related to standard compositions.
The alternating form is A344619.
Positions of zeros in A357623.
The half-alternating form is A357625, reverse A357626.
The reverse version is A357628.
The version for prime indices is A357632.
The version for Heinz numbers of partitions is A357636.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    skats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[(i+1)/2]),{i,Length[f]}];
    Select[Range[0,100],skats[stc[#]]==0&]

A357628 Numbers k such that the reversed k-th composition in standard order has skew-alternating sum 0.

Original entry on oeis.org

0, 3, 10, 14, 15, 36, 43, 44, 45, 52, 54, 58, 59, 61, 63, 136, 147, 149, 152, 153, 166, 168, 170, 175, 178, 179, 181, 183, 185, 190, 200, 204, 211, 212, 213, 217, 219, 221, 228, 230, 234, 235, 237, 239, 242, 246, 247, 250, 254, 255, 528, 547, 549, 553, 560
Offset: 1

Views

Author

Gus Wiseman, Oct 08 2022

Keywords

Comments

We define the skew-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A - B - C + D + E - F - G + ....
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 sequence together with the corresponding compositions begins:
    0: ()
    3: (1,1)
   10: (2,2)
   14: (1,1,2)
   15: (1,1,1,1)
   36: (3,3)
   43: (2,2,1,1)
   44: (2,1,3)
   45: (2,1,2,1)
   52: (1,2,3)
   54: (1,2,1,2)
   58: (1,1,2,2)
   59: (1,1,2,1,1)
   61: (1,1,1,2,1)
   63: (1,1,1,1,1,1)
		

Crossrefs

See link for sequences related to standard compositions.
The alternating form is A344619.
Positions of zeros are A357624, non-reverse A357623.
The half-alternating form is A357626, non-reverse A357625.
The non-reverse version is A357627.
The version for prime indices is A357632.
The version for Heinz numbers of partitions is A357636.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join @@ Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    skats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[(i+1)/2]),{i,Length[f]}];
    Select[Range[0,100],skats[Reverse[stc[#]]]==0&]

A357624 Skew-alternating sum of the reversed n-th composition in standard order.

Original entry on oeis.org

0, 1, 2, 0, 3, -1, 1, -1, 4, -2, 0, -2, 2, -2, 0, 0, 5, -3, -1, -3, 1, -3, -1, 1, 3, -3, -1, -1, 1, -1, 1, 1, 6, -4, -2, -4, 0, -4, -2, 2, 2, -4, -2, 0, 0, 0, 2, 2, 4, -4, -2, -2, 0, -2, 0, 2, 2, -2, 0, 0, 2, 0, 2, 0, 7, -5, -3, -5, -1, -5, -3, 3, 1, -5, -3, 1
Offset: 0

Views

Author

Gus Wiseman, Oct 08 2022

Keywords

Comments

We define the skew-alternating sum of a sequence (A, B, C, D, E, F, G, ...) to be A - B - C + D + E - F - G + ....
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 357-th composition is (2,1,3,2,1) so a(357) = 1 - 2 - 3 + 2 + 1 = -1.
The 358-th composition is (2,1,3,1,2) so a(358) = 2 - 1 - 3 + 1 + 2 = 1.
		

Crossrefs

See link for sequences related to standard compositions.
The half-alternating form is A357622, non-reverse A357621.
The reverse version is A357623.
Positions of zeros are A357628, non-reverse A357627.
The version for prime indices is A357630.
The version for Heinz numbers of partitions is A357634.
A124754 gives alternating sum of standard compositions, reverse A344618.
A357637 counts partitions by half-alternating sum, skew A357638.
A357641 counts comps w/ half-alt sum 0, partitions A357639, even A357642.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    skats[f_]:=Sum[f[[i]]*(-1)^(1+Ceiling[(i+1)/2]),{i,Length[f]}];
    Table[skats[Reverse[stc[n]]],{n,0,100}]
Showing 1-10 of 10 results.