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 26 results. Next

A025048 Number of up/down (initially ascending) compositions of n.

Original entry on oeis.org

1, 1, 1, 2, 3, 4, 7, 11, 16, 26, 41, 64, 100, 158, 247, 389, 612, 960, 1509, 2372, 3727, 5858, 9207, 14468, 22738, 35737, 56164, 88268, 138726, 218024, 342652, 538524, 846358, 1330160, 2090522, 3285526, 5163632, 8115323, 12754288, 20045027, 31503382
Offset: 0

Views

Author

Keywords

Comments

Original name was: Ascending wiggly sums: number of sums adding to n in which terms alternately increase and decrease.
A composition is up/down if it is alternately strictly increasing and strictly decreasing, starting with an increase. For example, the partition (3,2,2,2,1) has no up/down permutations, even though it does have the anti-run permutation (2,3,2,1,2). - Gus Wiseman, Jan 15 2022

Examples

			From _Gus Wiseman_, Jan 15 2022: (Start)
The a(1) = 1 through a(7) = 11 up/down compositions:
  (1)  (2)  (3)    (4)      (5)      (6)        (7)
            (1,2)  (1,3)    (1,4)    (1,5)      (1,6)
                   (1,2,1)  (2,3)    (2,4)      (2,5)
                            (1,3,1)  (1,3,2)    (3,4)
                                     (1,4,1)    (1,4,2)
                                     (2,3,1)    (1,5,1)
                                     (1,2,1,2)  (2,3,2)
                                                (2,4,1)
                                                (1,2,1,3)
                                                (1,3,1,2)
                                                (1,2,1,2,1)
(End)
		

Crossrefs

The case of permutations is A000111.
The undirected version is A025047, ranked by A345167.
The down/up version is A025049, ranked by A350356.
The strict case is A129838, undirected A349054.
The weak version is A129852, down/up A129853.
The version for patterns is A350354.
These compositions are ranked by A350355.
A001250 counts alternating permutations, complement A348615.
A003242 counts Carlitz compositions, complement A261983.
A011782 counts compositions, unordered A000041.
A325534 counts separable partitions, complement A325535.
A345192 counts non-alternating compositions, ranked by A345168.
A345194 counts alternating patterns, complement A350252.
A349052 counts weakly alternating compositions, complement A349053.

Programs

  • Mathematica
    updoQ[y_]:=And@@Table[If[EvenQ[m],y[[m]]>y[[m+1]],y[[m]]Gus Wiseman, Jan 15 2022 *)

Formula

a(n) = 1 + A025047(n) - A025049(n) = Sum_k A059882(n,k). - Henry Bottomley, Feb 05 2001
a(n) ~ c * d^n, where d = 1.571630806607064114100138865739690782401305155950789062725011227781640624..., c = 0.4408955566119650057730070154620695491718230084159159991449729825619... . - Vaclav Kotesovec, Sep 12 2014

Extensions

Name and offset changed by Gus Wiseman, Jan 15 2022

A025049 Number of down/up (initially descending) compositions of n.

Original entry on oeis.org

1, 1, 1, 2, 2, 4, 6, 9, 14, 23, 35, 55, 87, 136, 214, 337, 528, 830, 1306, 2051, 3223, 5067, 7962, 12512, 19667, 30908, 48574, 76343, 119982, 188565, 296358, 465764, 732006, 1150447, 1808078, 2841627, 4465992, 7018891, 11031101, 17336823, 27247087, 42822355
Offset: 0

Views

Author

Keywords

Comments

Original name was: Descending wiggly sums: number of sums adding to n in which terms alternately decrease and increase.
A composition is down/up if it is alternately strictly decreasing and strictly increasing, starting with a decrease. For example, the partition (3,2,2,2,1) has no down/up permutations, even though it does have the anti-run permutation (2,1,2,3,2). - Gus Wiseman, Jan 28 2022

Examples

			From _Gus Wiseman_, Jan 28 2022: (Start)
The a(1) = 1 through a(8) = 14 down/up compositions:
  (1)  (2)  (3)    (4)    (5)      (6)        (7)        (8)
            (2,1)  (3,1)  (3,2)    (4,2)      (4,3)      (5,3)
                          (4,1)    (5,1)      (5,2)      (6,2)
                          (2,1,2)  (2,1,3)    (6,1)      (7,1)
                                   (3,1,2)    (2,1,4)    (2,1,5)
                                   (2,1,2,1)  (3,1,3)    (3,1,4)
                                              (4,1,2)    (3,2,3)
                                              (2,1,3,1)  (4,1,3)
                                              (3,1,2,1)  (5,1,2)
                                                         (2,1,3,2)
                                                         (2,1,4,1)
                                                         (3,1,3,1)
                                                         (4,1,2,1)
                                                         (2,1,2,1,2)
(End)
		

Crossrefs

The case of permutations is A000111.
The undirected version is A025047, ranked by A345167.
The up/down version is A025048, ranked by A350355.
The strict case is A129838, undirected A349054.
The weak version is A129853, up/down A129852.
The version for patterns is A350354.
These compositions are ranked by A350356.
A001250 counts alternating permutations, complement A348615.
A003242 counts Carlitz compositions, complement A261983.
A011782 counts compositions, unordered A000041.
A325534 counts separable partitions, complement A325535.
A345192 counts non-alternating compositions, ranked by A345168.
A345194 counts alternating patterns, complement A350252.
A349052 counts weakly alternating compositions, complement A349053.

Programs

  • Mathematica
    doupQ[y_]:=And@@Table[If[EvenQ[m],y[[m]]y[[m+1]]],{m,1,Length[y]-1}];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],doupQ]],{n,0,15}] (* Gus Wiseman, Jan 28 2022 *)

Formula

a(n) = 1 + A025047(n) - A025048(n) = Sum_{k=1..n} A059883(n,k). - Henry Bottomley, Feb 05 2001

Extensions

a(0)=1 prepended by Alois P. Heinz, Jan 20 2022
Name changed by Gus Wiseman, Jan 28 2022

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

A349060 Number of integer partitions of n that are constant or whose part multiplicities, except possibly the first and last, are all even.

Original entry on oeis.org

1, 1, 2, 3, 5, 7, 10, 13, 18, 22, 29, 35, 45, 53, 68, 77, 98, 112, 140, 157, 195, 218, 270, 298, 367, 404, 495, 542, 658, 721, 873, 949, 1145, 1245, 1494, 1615, 1934, 2091, 2492, 2688, 3188, 3436, 4068, 4369, 5155, 5537, 6511, 6976, 8186, 8763, 10251, 10962
Offset: 0

Views

Author

Gus Wiseman, Dec 06 2021

Keywords

Comments

Also the number of weakly alternating integer partitions of n, where we define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either. This sequence looks at the somewhat degenerate case where no strict increases are allowed.

Examples

			The a(1) = 1 through a(7) = 13 partitions:
  (1)  (2)   (3)    (4)     (5)      (6)       (7)
       (11)  (21)   (22)    (32)     (33)      (43)
             (111)  (31)    (41)     (42)      (52)
                    (211)   (221)    (51)      (61)
                    (1111)  (311)    (222)     (322)
                            (2111)   (411)     (331)
                            (11111)  (2211)    (511)
                                     (3111)    (2221)
                                     (21111)   (4111)
                                     (111111)  (22111)
                                               (31111)
                                               (211111)
                                               (1111111)
		

Crossrefs

Alternating: A025047, ranked by A345167, also A025048 and A025049.
The strong case is A065033, ranked by A167171.
A directed version is A096441.
Non-alternating: A345192, ranked by A345168.
Weakly alternating: A349052, also A129852 and A129853.
Non-weakly alternating: A349053, ranked by A349057.
A version for ordered factorizations is A349059, strong A348610.
The complement is counted by A349061, strong A349801.
These partitions are ranked by the complement of A349794.
The non-strict case is A349795.
A000041 counts integer partitions, ordered A011782.
A001250 counts alternating permutations, complement A348615.
A344604 counts alternating compositions with twins.
A345170 counts partitions w/ an alternating permutation, ranked by A345172.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n], SameQ@@#||And@@EvenQ/@Take[Length/@Split[#],{2,-2}]&]],{n,0,30}]
  • PARI
    A_x(N)={my(x='x+O('x^N), g= 1 + sum(i=1, N, (x^i/(1-x^i)) * (1 + sum(j=i+1, N-i, (x^j/((1-x^j))) / prod(k=1, j-i-1, 1-x^(2*(i+k)))))));
    Vec(g)}
    A_x(52) \\ John Tyler Rascoe, Mar 20 2024

Formula

G.f.: 1 + Sum_{i>0} (x^i/(1-x^i)) * (1 + Sum_{j>i} (x^j/(1-x^j)) / Product_{k=1..j-i-1} (1-x^(2*(i+k)))). - John Tyler Rascoe, Mar 20 2024

A349061 Number of integer partitions of n with at least one part of odd multiplicity that is not the first or last.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 2, 4, 8, 13, 21, 32, 48, 67, 99, 133, 185, 245, 333, 432, 574, 732, 957, 1208, 1554, 1941, 2468, 3060, 3844, 4731, 5893, 7204, 8898, 10816, 13268, 16043, 19546, 23523, 28497, 34150, 41147, 49106, 58892, 70020, 83597, 99047, 117778, 139087
Offset: 0

Views

Author

Gus Wiseman, Dec 06 2021

Keywords

Comments

Also the number of non-weakly alternating integer partitions of n, where we define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either. This sequence looks at the somewhat degenerate case where no strict increases are allowed.

Examples

			The a(6) = 1 through a(10) = 13 partitions:
  (321)  (421)   (431)    (432)     (532)
         (3211)  (521)    (531)     (541)
                 (4211)   (621)     (631)
                 (32111)  (3321)    (721)
                          (4311)    (4321)
                          (5211)    (5311)
                          (42111)   (6211)
                          (321111)  (32221)
                                    (33211)
                                    (43111)
                                    (52111)
                                    (421111)
                                    (3211111)
		

Crossrefs

The strong version for compositions is A345192, ranked by A345168.
The version for compositions is A349053, ranked by A349057.
The complement is counted by A349060.
These partitions are ranked by A349794.
The non-strict case is A349796, complement A349795.
The strong case is A349801.
A000041 counts integer partitions.
A001250 counts alternating permutations, complement A348615.
A003242 counts Carlitz (anti-run) compositions.
A025047 counts alternating compositions, ranked by A345167.
A025048 and A025049 count directed alternating compositions.
A096441 counts weakly alternating 0-appended partitions.
A345170 counts partitions w/ an alternating permutation, ranked by A345172.
A349052 counts weakly alternating compositions.
A349056 counts weakly alternating permutations of prime indices.
A349798 counts weakly but not strongly alternating perms of prime indices.

Programs

  • Mathematica
    Table[Length[Select[IntegerPartitions[n], !SameQ@@#&&!And@@EvenQ/@Take[Length/@Split[#],{2,-2}]&]],{n,0,30}]

A349056 Number of weakly alternating permutations of the multiset of prime factors of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 2, 2, 1, 1, 3, 1, 3, 2, 2, 1, 4, 1, 2, 1, 3, 1, 4, 1, 1, 2, 2, 2, 4, 1, 2, 2, 4, 1, 4, 1, 3, 3, 2, 1, 5, 1, 3, 2, 3, 1, 4, 2, 4, 2, 2, 1, 6, 1, 2, 3, 1, 2, 4, 1, 3, 2, 4, 1, 6, 1, 2, 3, 3, 2, 4, 1, 5, 1, 2, 1, 6, 2, 2, 2
Offset: 1

Views

Author

Gus Wiseman, Dec 02 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 alternating in the sense of A025047 iff it is a weakly alternating anti-run.
A prime index of n is a number m such that prime(m) divides n. For n > 1, the multiset of prime factors of n is row n of A027746. The prime indices A112798 can also be used.

Examples

			The following are the weakly alternating permutations for selected n:
n = 2   6    12    24     48      60     90     120     180
   ----------------------------------------------------------
    2   23   223   2223   22223   2253   2335   22253   22335
        32   232   2232   22232   2325   2533   22325   22533
             322   2322   22322   2523   3253   22523   23253
                   3222   23222   3252   3325   23252   23352
                          32222   3522   3352   25232   25233
                                  5232   3523   32225   25332
                                         5233   32522   32325
                                         5332   35222   32523
                                                52223   33252
                                                52322   33522
                                                        35232
                                                        52323
                                                        53322
		

Crossrefs

Counting all permutations of prime factors gives A008480.
The variation counting anti-run permutations is A335452.
The strong case is A345164, with twins A344606.
Compositions of this type are counted by A349052, also A129852 and A129853.
Compositions not of this type are counted by A349053, ranked by A349057.
The version for patterns is A349058, strong A345194.
The version for ordered factorizations is A349059, strong A348610.
Partitions of this type are counted by A349060, complement A349061.
The complement is counted by A349797.
The non-alternating case is A349798.
A001250 counts alternating permutations, complement A348615.
A003242 counts Carlitz (anti-run) compositions.
A025047 counts alternating or wiggly compositions, ranked by A345167.
A056239 adds up prime indices, row sums of A112798, row lengths A001222.
A071321 gives the alternating sum of prime factors, reverse A071322.
A344616 gives the alternating sum of prime indices, reverse A316524.
A345165 counts partitions w/o an alternating permutation, ranked by A345171.
A345170 counts partitions w/ an alternating permutation, ranked by A345172.
A348379 counts factorizations with an alternating permutation.
A349800 counts weakly but not strongly alternating compositions.

Programs

  • Mathematica
    primeMS[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
    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[Permutations[primeMS[n]],whkQ[#]||whkQ[-#]&]],{n,100}]

A349059 Number of weakly alternating ordered factorizations of n.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 4, 2, 3, 1, 8, 1, 3, 3, 8, 1, 8, 1, 8, 3, 3, 1, 18, 2, 3, 4, 8, 1, 11, 1, 16, 3, 3, 3, 22, 1, 3, 3, 18, 1, 11, 1, 8, 8, 3, 1, 38, 2, 8, 3, 8, 1, 18, 3, 18, 3, 3, 1, 32, 1, 3, 8, 28, 3, 11, 1, 8, 3, 11, 1, 56, 1, 3, 8, 8, 3, 11, 1, 38, 8, 3
Offset: 1

Views

Author

Gus Wiseman, Dec 04 2021

Keywords

Comments

An ordered factorization of n is a finite sequence of positive integers > 1 with product n.
We define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either.

Examples

			The ordered factorizations for n = 2, 4, 6, 8, 12, 24, 30:
  (2)  (4)    (6)    (8)      (12)     (24)       (30)
       (2*2)  (2*3)  (2*4)    (2*6)    (3*8)      (5*6)
              (3*2)  (4*2)    (3*4)    (4*6)      (6*5)
                     (2*2*2)  (4*3)    (6*4)      (10*3)
                              (6*2)    (8*3)      (15*2)
                              (2*2*3)  (12*2)     (2*15)
                              (2*3*2)  (2*12)     (3*10)
                              (3*2*2)  (2*2*6)    (2*5*3)
                                       (2*4*3)    (3*2*5)
                                       (2*6*2)    (3*5*2)
                                       (3*2*4)    (5*2*3)
                                       (3*4*2)
                                       (4*2*3)
                                       (6*2*2)
                                       (2*2*2*3)
                                       (2*2*3*2)
                                       (2*3*2*2)
                                       (3*2*2*2)
		

Crossrefs

The strong version for compositions is A025047, also A025048, A025049.
The strong case is A348610, complement A348613.
The version for compositions is A349052, complement A349053.
As compositions these are ranked by the complement of A349057.
A001055 counts factorizations, strict A045778, ordered A074206.
A001250 counts alternating permutations, complement A348615.
A335434 counts separable factorizations, complement A333487.
A345164 counts alternating permutations of prime factors, w/ twins A344606.
A345170 counts partitions with an alternating permutation.
A348379 = factorizations w/ alternating permutation, complement A348380.
A348611 counts anti-run ordered factorizations, complement A348616.
A349060 counts weakly alternating partitions, complement A349061.
A349800 = weakly but not strongly alternating compositions, ranked A349799.

Programs

  • Mathematica
    facs[n_]:=If[n<=1,{{}},Join@@Table[Map[Prepend[#,d]&, Select[facs[n/d],Min@@#>=d&]],{d,Rest[Divisors[n]]}]];
    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/@facs[n], whkQ[#]||whkQ[-#]&]],{n,100}]

Formula

a(2^n) = A349052(n).

A349054 Number of alternating strict compositions of n. Number of alternating (up/down or down/up) permutations of strict integer partitions of n.

Original entry on oeis.org

1, 1, 1, 3, 3, 5, 9, 11, 15, 21, 35, 41, 59, 75, 103, 155, 193, 255, 339, 443, 569, 841, 1019, 1365, 1743, 2295, 2879, 3785, 5151, 6417, 8301, 10625, 13567, 17229, 21937, 27509, 37145, 45425, 58345, 73071, 93409, 115797, 147391, 182151, 229553, 297061, 365625
Offset: 0

Views

Author

Gus Wiseman, Dec 21 2021

Keywords

Comments

A strict composition of n is a finite sequence of distinct positive integers summing to n.
A sequence is alternating if it is alternately strictly increasing and strictly decreasing, starting with either.
The case starting with an increase (or decrease, it doesn't matter in the enumeration) is counted by A129838.

Examples

			The a(1) = 1 through a(7) = 11 compositions:
  (1)  (2)  (3)    (4)    (5)    (6)      (7)
            (1,2)  (1,3)  (1,4)  (1,5)    (1,6)
            (2,1)  (3,1)  (2,3)  (2,4)    (2,5)
                          (3,2)  (4,2)    (3,4)
                          (4,1)  (5,1)    (4,3)
                                 (1,3,2)  (5,2)
                                 (2,1,3)  (6,1)
                                 (2,3,1)  (1,4,2)
                                 (3,1,2)  (2,1,4)
                                          (2,4,1)
                                          (4,1,2)
		

Crossrefs

Ranking sequences are put in parentheses below.
This is the strict case of A025047/A025048/A025049 (A345167).
This is the alternating case of A032020 (A233564).
The unordered case (partitions) is A065033.
The directed case is A129838.
A001250 = alternating permutations (A349051), complement A348615 (A350250).
A003242 = Carlitz (anti-run) compositions, complement A261983.
A011782 = compositions, unordered A000041.
A345165 = partitions without an alternating permutation (A345171).
A345170 = partitions with an alternating permutation (A345172).
A345192 = non-alternating compositions (A345168).
A345195 = non-alternating anti-run compositions (A345169).
A349800 = weakly but not strongly alternating compositions (A349799).
A349052 = weakly alternating compositions, complement A349053 (A349057).

Programs

  • Maple
    g:= proc(u, o) option remember;
          `if`(u+o=0, 1, add(g(o-1+j, u-j), j=1..u))
        end:
    b:= proc(n, k) option remember; `if`(k<0 or n<0, 0,
          `if`(k=0, `if`(n=0, 2, 0), b(n-k, k)+b(n-k, k-1)))
        end:
    a:= n-> add(b(n, k)*g(k, 0), k=0..floor((sqrt(8*n+1)-1)/2))-1:
    seq(a(n), n=0..46);  # Alois P. Heinz, Dec 22 2021
  • Mathematica
    wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]==Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
    Table[Length[Select[Join@@Permutations/@Select[IntegerPartitions[n],UnsameQ@@#&],wigQ]],{n,0,15}]

Formula

a(n) = 2 * A129838(n) - 1.
G.f.: Sum_{n>0} A001250(n)*x^(n*(n+1)/2)/Product_{k=1..n}(1-x^k).

A349058 Number of weakly alternating patterns of length n.

Original entry on oeis.org

1, 1, 3, 11, 43, 203, 1123, 7235, 53171, 439595, 4037371, 40787579, 449500595, 5366500163, 68997666867, 950475759899, 13966170378907, 218043973366091, 3604426485899203, 62894287709616755, 1155219405655975763, 22279674547003283003, 450151092568978825707
Offset: 0

Views

Author

Gus Wiseman, Dec 04 2021

Keywords

Comments

We define a pattern to be a finite sequence covering an initial interval of positive integers. Patterns are counted by A000670 and ranked by A333217.
We define a sequence to be weakly alternating if it is alternately weakly increasing and weakly decreasing, starting with either.

Examples

			The a(1) = 1 through a(3) = 11 patterns:
  (1)  (1,1)  (1,1,1)
       (1,2)  (1,1,2)
       (2,1)  (1,2,1)
              (1,2,2)
              (1,3,2)
              (2,1,1)
              (2,1,2)
              (2,1,3)
              (2,2,1)
              (2,3,1)
              (3,1,2)
		

Crossrefs

The strict case is A001250, complement A348615.
The strong case of compositions is A025047, ranked by A345167.
The unordered version is A052955.
The strong case is A345194, with twins A344605. Also the directed case.
The version for compositions is A349052, complement A349053.
The version for permutations of prime indices: A349056, complement A349797.
The version for compositions is ranked by A349057.
The version for ordered factorizations is A349059, strong A348610.
The version for partitions is A349060, complement A349061.
A003242 counts Carlitz (anti-run) compositions.
A005649 counts anti-run patterns.
A344604 counts alternating compositions with twins.
A345163 counts normal partitions with an alternating permutation.
A345170 counts partitions w/ an alternating permutation, complement A345165.
A345192 counts non-alternating compositions, ranked by A345168.
A349055 counts multisets w/ an alternating permutation, complement A349050.

Programs

  • Mathematica
    allnorm[n_]:=If[n<=0,{{}},Function[s,Array[Count[s, y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1]];
    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/@allnorm[n],whkQ[#]||whkQ[-#]&]],{n,0,6}]
  • PARI
    R(n,k)={my(v=vector(k,i,1), u=vector(n)); for(r=1, n, if(r%2==0, my(s=v[k]); forstep(i=k, 2, -1, v[i] = s - v[i-1]); v[1] = s); for(i=2, k, v[i] += v[i-1]); u[r]=v[k]); u}
    seq(n)= {concat([1], -vector(n,i,1) + 2*sum(k=1, n, R(n, k)*sum(r=k, n, binomial(r, k)*(-1)^(r-k)) ) )} \\ Andrew Howroyd, Jan 13 2024

Extensions

a(9)-a(18) from Alois P. Heinz, Dec 10 2021
a(19) onwards from Andrew Howroyd, Jan 13 2024
Showing 1-10 of 26 results. Next