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.

Previous Showing 11-20 of 48 results. Next

A335548 Number of compositions of n with at least one non-contiguous value.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Jul 08 2020

Keywords

Comments

Also the number of compositions of n matching the pattern (1,2,1) or (2,1,2).

Examples

			The a(4) = 1 through a(6) = 10 compositions:
  (121)  (131)   (141)
         (212)   (1131)
         (1121)  (1212)
         (1211)  (1221)
                 (1311)
                 (2112)
                 (2121)
                 (11121)
                 (11211)
                 (12111)
		

Crossrefs

The complement is A274174.
The version for prime indices is A335460.
Anti-run compositions are A003242.
(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.

Programs

  • 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):
    seq(a(n), n=0..50);  # Alois P. Heinz, Jul 09 2020
  • 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];
    a /@ Range[0, 50] (* Jean-François Alcover, May 21 2021, after Alois P. Heinz *)

Formula

a(n) = A011782(n) - A274174(n). - Alois P. Heinz, Jul 09 2020

Extensions

More terms from Alois P. Heinz, Jul 09 2020

A349053 Number of non-weakly alternating integer compositions of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 4, 12, 37, 95, 232, 533, 1198, 2613, 5619, 11915, 25011, 52064, 107694, 221558, 453850, 926309, 1884942, 3825968, 7749312, 15667596, 31628516, 63766109, 128415848, 258365323, 519392582, 1043405306, 2094829709, 4203577778, 8431313237, 16904555958
Offset: 0

Views

Author

Gus Wiseman, Dec 16 2021

Keywords

Comments

We define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either. Then a sequence is (strongly) alternating iff it is a weakly alternating anti-run.

Examples

			The a(6) = 12 compositions:
  (1,1,2,2,1)  (1,1,2,3)  (1,2,4)
  (1,2,1,1,2)  (1,2,3,1)  (4,2,1)
  (1,2,2,1,1)  (1,3,2,1)
  (2,1,1,2,1)  (2,1,1,3)
               (3,1,1,2)
               (3,2,1,1)
		

Crossrefs

Complementary directed versions are A129852/A129853, strong A025048/A025049.
The strong version is A345192.
The complement is counted by A349052.
These compositions are ranked by A349057, strong A345168.
The complementary version for patterns is A349058, strong A345194.
The complementary multiplicative version is A349059, strong A348610.
An unordered version (partitions) is A349061, complement A349060.
The version for ordered prime factorizations is A349797, complement A349056.
The version for patterns is A350138, strong A350252.
The version for ordered factorizations is A350139.
A001250 counts alternating permutations, complement A348615.
A001700 counts compositions of 2n with alternating sum 0.
A003242 counts Carlitz (anti-run) compositions.
A011782 counts compositions, unordered A000041.
A025047 counts alternating compositions, ranked by A345167.
A106356 counts compositions by number of maximal anti-runs.
A344604 counts alternating compositions with twins.
A345164 counts alternating ordered prime factorizations.
A349054 counts strict alternating compositions.

Programs

  • Mathematica
    wwkQ[y_]:=And@@Table[If[EvenQ[m],y[[m]]<=y[[m+1]],y[[m]]>=y[[m+1]]],{m,1,Length[y]-1}]||And@@Table[If[EvenQ[m],y[[m]]>=y[[m+1]],y[[m]]<=y[[m+1]]],{m,1,Length[y]-1}];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],!wwkQ[#]&]],{n,0,10}]

Formula

a(n) = A011782(n) - A349052(n).

Extensions

a(21)-a(35) from Martin Ehrenstein, Jan 08 2022

A349052 Number of weakly alternating compositions of n.

Original entry on oeis.org

1, 1, 2, 4, 8, 16, 28, 52, 91, 161, 280, 491, 850, 1483, 2573, 4469, 7757, 13472, 23378, 40586, 70438, 122267, 212210, 368336, 639296, 1109620, 1925916, 3342755, 5801880, 10070133, 17478330, 30336518, 52653939, 91389518, 158621355, 275313226, 477850887, 829388075
Offset: 0

Views

Author

Gus Wiseman, Nov 29 2021

Keywords

Comments

We define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either. A sequence is alternating iff it is a weakly alternating anti-run.

Examples

			The a(5) = 16 compositions:
  (1,1,1,1,1)  (1,1,1,2)  (1,1,3)  (1,4)  (5)
               (1,1,2,1)  (1,2,2)  (2,3)
               (1,2,1,1)  (1,3,1)  (3,2)
               (2,1,1,1)  (2,1,2)  (4,1)
                          (2,2,1)
                          (3,1,1)
The a(6) = 28 compositions:
  (111111)  (11112)  (1113)  (114)  (15)  (6)
            (11121)  (1122)  (132)  (24)
            (11211)  (1131)  (141)  (33)
            (12111)  (1212)  (213)  (42)
            (21111)  (1311)  (222)  (51)
                     (2121)  (231)
                     (2211)  (312)
                     (3111)  (411)
		

Crossrefs

The strong case is A025047, ranked by A345167.
The directed versions are A129852 and A129853, strong A025048 and A025049.
The complement is counted by A349053, strong A345192.
The version for permutations of prime indices is A349056, strong A345164.
The complement is ranked by A349057, strong A345168.
The version for patterns is A349058, strong A345194.
The multiplicative version is A349059, strong A348610.
An unordered version (partitions) is A349060, complement A349061.
The non-alternating case is A349800, ranked by A349799.
A001250 counts alternating permutations, complement A348615.
A001700 counts compositions of 2n with alternating sum 0.
A003242 counts Carlitz (anti-run) compositions.
A011782 counts compositions.
A106356 counts compositions by number of maximal anti-runs.
A344604 counts alternating compositions with twins.
A345170 counts partitions w/ an alternating permutation, ranked by A345172.
A349054 counts strict alternating compositions.

Programs

  • Mathematica
    whkQ[y_]:=And@@Table[If[EvenQ[m],y[[m]]<=y[[m+1]],y[[m]]>=y[[m+1]]],{m,1,Length[y]-1}];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],whkQ[#]||whkQ[-#]&]],{n,0,10}]
  • PARI
    C(n,f)={my(M=matrix(n,n,j,k,k>=j), s=M[,n]); for(b=1, n, f=!f; M=matrix(n,n,j,k, if(k1,M[j-k,k-1]) ))); for(k=2, n, M[,k]+=M[,k-1]); s+=M[,n]); s~}
    seq(n) = concat([1], C(n,0) + C(n,1) - vector(n,j,numdiv(j))) \\ Andrew Howroyd, Jan 31 2024

Extensions

a(21)-a(37) from Martin Ehrenstein, Jan 08 2022

A349057 Numbers k such that the k-th composition in standard order is not weakly alternating.

Original entry on oeis.org

37, 46, 52, 53, 69, 75, 78, 92, 93, 101, 104, 105, 107, 110, 116, 117, 133, 137, 139, 142, 150, 151, 156, 157, 165, 174, 180, 181, 184, 185, 186, 187, 190, 197, 200, 201, 203, 206, 208, 209, 210, 211, 214, 215, 220, 221, 229, 232, 233, 235, 238, 244, 245, 261
Offset: 1

Views

Author

Gus Wiseman, Dec 04 2021

Keywords

Comments

We define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either.
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 terms and corresponding compositions begin:
   37: (3,2,1)
   46: (2,1,1,2)
   52: (1,2,3)
   53: (1,2,2,1)
   69: (4,2,1)
   75: (3,2,1,1)
   78: (3,1,1,2)
   92: (2,1,1,3)
   93: (2,1,1,2,1)
  101: (1,3,2,1)
  104: (1,2,4)
  105: (1,2,3,1)
  107: (1,2,2,1,1)
  110: (1,2,1,1,2)
  116: (1,1,2,3)
  117: (1,1,2,2,1)
		

Crossrefs

The strong case is A345168, complement A345167, counted by A345192.
The strong anti-run case is A345169, counted by A345195.
Including all non-anti-runs gives A348612, complement A333489.
These compositions are counted by A349053, complement A349052.
The directed cases are counted by A129852 (incr.) and A129853 (decr.).
The complement for patterns is A349058, strong A345194.
The complement for ordered factorizations is A349059, strong A348610.
Partitions of this type are counted by A349061, complement A349060.
Partitions of this type are ranked by A349794.
Non-strict partitions of this type are counted by A349796.
Permutations of prime indices of this type are counted by A349797.
A001250 counts alternating permutations, complement A348615.
A003242 counts Carlitz (anti-run) compositions, complement A261983.
A011782 counts compositions.
A025047 counts alternating/wiggly compositions, directed A025048, A025049.
A345164 counts alternating permutations of prime indices, weak A349056.
A345165 counts partitions w/o an alternating permutation, ranked by A345171.
A345170 counts partitions w/ an alternating permutation, ranked by A345172.
A349054 counts strict alternating compositions.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[ Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    whkQ[y_]:=And@@Table[If[EvenQ[m], y[[m]]<=y[[m+1]],y[[m]]>=y[[m+1]]],{m,1,Length[y]-1}];
    Select[Range[0,100],!whkQ[stc[#]]&&!whkQ[-stc[#]]&]

A357182 Number of integer compositions of n with the same length as their alternating sum.

Original entry on oeis.org

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
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) = 6 compositions:
  (1)  (31)  (113)  (42)  (124)  (53)
             (212)        (223)  (1151)
             (311)        (322)  (2141)
                          (421)  (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.
For absolute value we have A357183.
These compositions are ranked by A357184.
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[#]==ats[#]&]],{n,0,15}]

Extensions

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

A353860 Number of collapsible integer compositions of n.

Original entry on oeis.org

0, 1, 2, 2, 5, 2, 12, 2, 26, 9, 36, 2, 206, 2, 132, 40, 677, 2, 1746, 2, 3398, 136, 2052, 2, 44388, 33, 8196, 730, 79166, 2, 263234, 2, 458330, 2056, 131076, 160, 8804349, 2, 524292, 8200, 13662156, 2, 36036674, 2, 48844526, 90282, 8388612, 2, 1971667502, 129
Offset: 0

Views

Author

Gus Wiseman, Jun 04 2022

Keywords

Comments

If a collapse is a joining of some number of adjacent equal parts of an integer composition, we call a composition collapsible iff by some sequence of collapses it can be reduced to a single part. An example of such a sequence of collapses is (1,1,1,3,2,1,1,2) -> (3,3,2,1,1,2) -> (3,3,2,2,2) -> (6,2,2,2) -> (6,6) -> (12), which shows that (1,1,1,3,2,1,1,2) is a collapsible composition of 12.

Examples

			The a(0) = 0 through a(6) = 12 compositions:
  .  (1)  (2)   (3)    (4)     (5)      (6)
          (11)  (111)  (22)    (11111)  (33)
                       (112)            (222)
                       (211)            (1113)
                       (1111)           (1122)
                                        (2112)
                                        (2211)
                                        (3111)
                                        (11112)
                                        (11211)
                                        (21111)
                                        (111111)
		

Crossrefs

The version for partitions is A275870, ranked by A300273.
A003242 counts anti-run compositions, ranked by A333489, complement A261983.
A011782 counts compositions.
A353847 represents the run-sums of a composition, partitions A353832.
A353853-A353859 pertain to composition run-sum trajectory.
A353932 lists run-sums of standard compositions.

Programs

  • Mathematica
    repcams[q_List]:=repcams[q]=Union[{q},If[UnsameQ@@q,{},Union@@repcams/@ Union[Insert[Drop[q,#],Plus@@Take[q,#],First[#]]&/@ Select[Tuples[Range[Length[q]],2],And[Less@@#,SameQ@@Take[q,#]]&]]]];
    Table[Length[Select[Join@@Permutations/@ IntegerPartitions[n],MemberQ[repcams[#],{n}]&]],{n,0,15}]
  • PARI
    a(n) = if(n==0, 0, 1 - sumdiv(n, d, if(d>1, moebius(d)*a(n/d)^d ))) \\ Andrew Howroyd, Feb 04 2023

Formula

Sum_{d|n} mu(d)*a(n/d)^d = 1 for n > 0. - Andrew Howroyd, Feb 04 2023

Extensions

Terms a(16) and beyond from Andrew Howroyd, Feb 04 2023

A353863 Number of integer partitions of n whose weak run-sums cover an initial interval of nonnegative integers.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 4, 6, 7, 10, 11, 16, 20, 24, 30, 43, 47, 62, 79, 94, 113, 143, 170, 211, 256, 307, 372, 449, 531, 648, 779, 926, 1100, 1323, 1562, 1864, 2190, 2595, 3053, 3611, 4242, 4977, 5834, 6825, 7973, 9344, 10844, 12641, 14699, 17072, 19822
Offset: 0

Views

Author

Gus Wiseman, Jun 04 2022

Keywords

Comments

A weak run-sum of a sequence is the sum of any consecutive constant subsequence. For example, the weak run-sums of (3,2,2,1) are {1,2,3,4}.
This is a kind of completeness property, cf. A126796.

Examples

			The a(1) = 1 through a(8) = 7 partitions:
  (1)  (11)  (21)   (211)   (311)    (321)     (3211)     (3221)
             (111)  (1111)  (2111)   (3111)    (4111)     (32111)
                            (11111)  (21111)   (22111)    (41111)
                                     (111111)  (31111)    (221111)
                                               (211111)   (311111)
                                               (1111111)  (2111111)
                                                          (11111111)
		

Crossrefs

For parts instead of weak run-sums we have A000009.
For multiplicities instead of weak run-sums we have A317081.
If weak run-sums are distinct we have A353865, the completion of A353864.
A003242 counts anti-run compositions, ranked by A333489, complement A261983.
A005811 counts runs in binary expansion.
A165413 counts distinct run-lengths in binary expansion, sums A353929.
A300273 ranks collapsible partitions, counted by A275870, comps A353860.
A353832 represents taking run-sums of a partition, compositions A353847.
A353833 ranks partitions with all equal run-sums, counted by A304442.
A353835 counts distinct run-sums of prime indices.
A353837 counts partitions with distinct run-sums, ranked by A353838.
A353840-A353846 pertain to partition run-sum trajectory.
A353861 counts distinct weak run-sums of prime indices.
A353932 lists run-sums of standard compositions.

Programs

  • Mathematica
    normQ[m_]:=m=={}||Union[m]==Range[Max[m]];
    msubs[s_]:=Join@@@Tuples[Table[Take[t,i],{t,Split[s]},{i,0,Length[t]}]];
    wkrs[y_]:=Union[Total/@Select[msubs[y],SameQ@@#&]];
    Table[Length[Select[IntegerPartitions[n],normQ[Rest[wkrs[#]]]&]],{n,0,15}]
  • PARI
    \\ isok(p) tests the partition.
    isok(p)={my(b=0, s=0, t=0); for(i=1, #p, if(p[i]<>t, t=p[i]; s=0); s += t; b = bitor(b, 1<<(s-1))); bitand(b,b+1)==0}
    a(n) = {my(r=0); forpart(p=n, r+=isok(p)); r} \\ Andrew Howroyd, Jan 15 2024

Extensions

a(31) onwards from Andrew Howroyd, Jan 15 2024

A128695 Number of compositions of n with parts in N which avoid the adjacent pattern 111.

Original entry on oeis.org

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

Views

Author

Ralf Stephan, May 08 2007

Keywords

Examples

			From _Gus Wiseman_, Jul 06 2020: (Start)
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)
		

Crossrefs

Column k=0 of A232435.
The matching version is A335464.
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.

Programs

  • 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):
    seq(a(n), n=0..40);  # Alois P. Heinz, Nov 23 2013
  • 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 *)

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
For n>=2, a(n) = A091616(n) + A003242(n). - Vaclav Kotesovec, Jul 07 2020

A345195 Number of non-alternating anti-run compositions of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 2, 4, 10, 23, 49, 96, 192, 368, 692, 1299, 2403, 4400, 8029, 14556, 26253, 47206, 84574, 151066, 269244, 478826, 849921, 1506309, 2665829, 4711971, 8319763, 14675786, 25865400, 45552678, 80171353, 141015313, 247905305, 435614270, 765132824
Offset: 0

Views

Author

Gus Wiseman, Jun 17 2021

Keywords

Comments

A sequence is alternating if it is alternately strictly increasing and strictly decreasing, starting with either. For example, the partition (3,2,2,2,1) has no alternating permutations, even though it does have the anti-run permutations (2,3,2,1,2) and (2,1,2,3,2).
An anti-run (separation or Carlitz composition) is a sequence with no adjacent equal parts.

Examples

			The a(9) = 23 anti-runs:
  (1,2,6)  (1,2,4,2)  (1,2,1,2,3)
  (1,3,5)  (1,2,5,1)  (1,2,3,1,2)
  (2,3,4)  (1,3,4,1)  (1,2,3,2,1)
  (4,3,2)  (1,4,3,1)  (1,3,2,1,2)
  (5,3,1)  (1,5,2,1)  (2,1,2,3,1)
  (6,2,1)  (2,1,2,4)  (2,1,3,2,1)
           (2,4,2,1)  (3,2,1,2,1)
           (3,1,2,3)
           (3,2,1,3)
           (4,2,1,2)
		

Crossrefs

Non-anti-run compositions are counted by A261983.
A version counting partitions is A345166, ranked by A345173.
These compositions are ranked by A345169.
Non-alternating compositions are counted by A345192, ranked by A345168.
A001250 counts alternating permutations, complement A348615.
A003242 counts anti-run compositions, ranked by A333489.
A011782 counts compositions.
A025047 counts alternating or wiggly compositions, ranked by A345167.
A032020 counts strict compositions.
A106356 counts compositions by number of maximal anti-runs.
A325534 counts separable partitions, ranked by A335433.
A325535 counts inseparable partitions, ranked by A335448.
A345164 counts alternating permutations of prime indices, w/ twins A344606.
A345165 counts partitions w/o an alternating permutation, ranked by A345171.
A345170 counts partitions w/ an alternating permutation, ranked by A345172.
A345194 counts alternating patterns (with twins: A344605).

Programs

  • Mathematica
    wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]== Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
    sepQ[y_]:=!MatchQ[y,{_,x_,x_,_}];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n], sepQ[#]&&!wigQ[#]&]],{n,0,15}]

Formula

a(n) = A003242(n) - A025047(n).

Extensions

a(21) onwards from Andrew Howroyd, Jan 31 2024

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
Previous Showing 11-20 of 48 results. Next