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

A096441 Number of palindromic and unimodal compositions of n. Equivalently, the number of orbits under conjugation of even nilpotent n X n matrices.

Original entry on oeis.org

1, 2, 2, 4, 3, 7, 5, 11, 8, 17, 12, 26, 18, 37, 27, 54, 38, 76, 54, 106, 76, 145, 104, 199, 142, 266, 192, 357, 256, 472, 340, 621, 448, 809, 585, 1053, 760, 1354, 982, 1740, 1260, 2218, 1610, 2818, 2048, 3559, 2590, 4485, 3264, 5616, 4097, 7018, 5120, 8728, 6378
Offset: 1

Views

Author

Nolan R. Wallach (nwallach(AT)ucsd.edu), Aug 10 2004

Keywords

Comments

Number of partitions of n such that all differences between successive parts are even, see example. [Joerg Arndt, Dec 27 2012]
Number of partitions of n where either all parts are odd or all parts are even. - Omar E. Pol, Aug 16 2013
From Gus Wiseman, Jan 13 2022: (Start)
Also the number of integer partitions of n with all even multiplicities (or run-lengths) except possibly the first. These are the conjugates of the partitions described by Joerg Arndt above. For example, the a(1) = 1 through a(8) = 11 partitions are:
(1) (2) (3) (4) (5) (6) (7) (8)
(11) (111) (22) (311) (33) (322) (44)
(211) (11111) (222) (511) (422)
(1111) (411) (31111) (611)
(2211) (1111111) (2222)
(21111) (3311)
(111111) (22211)
(41111)
(221111)
(2111111)
(11111111)
(End)

Examples

			From _Joerg Arndt_, Dec 27 2012: (Start)
There are a(10)=17 partitions of 10 where all differences between successive parts are even:
[ 1]  [ 1 1 1 1 1 1 1 1 1 1 ]
[ 2]  [ 2 2 2 2 2 ]
[ 3]  [ 3 1 1 1 1 1 1 1 ]
[ 4]  [ 3 3 1 1 1 1 ]
[ 5]  [ 3 3 3 1 ]
[ 6]  [ 4 2 2 2 ]
[ 7]  [ 4 4 2 ]
[ 8]  [ 5 1 1 1 1 1 ]
[ 9]  [ 5 3 1 1 ]
[10]  [ 5 5 ]
[11]  [ 6 2 2 ]
[12]  [ 6 4 ]
[13]  [ 7 1 1 1 ]
[14]  [ 7 3 ]
[15]  [ 8 2 ]
[16]  [ 9 1 ]
[17]  [ 10 ]
(End)
		

References

  • A. G. Elashvili and V. G. Kac, Classification of good gradings of simple Lie algebras. Lie groups and invariant theory, 85-104, Amer. Math. Soc. Transl. Ser. 2, 213, Amer. Math. Soc., Providence, RI, 2005.

Crossrefs

Bisections are A078408 and A096967.
The complement in partitions is counted by A006477
A version for compositions is A016116.
A pointed version is A035363, ranked by A066207.
A000041 counts integer partitions.
A025065 counts palindromic partitions.
A027187 counts partitions with even length/maximum.
A035377 counts partitions using multiples of 3.
A058696 counts partitions of even numbers, ranked by A300061.
A340785 counts factorizations into even factors.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(i>n, 0,
          `if`(irem(n, i)=0, 1, 0) +add(`if`(irem(j, 2)=0,
           b(n-i*j, i+1), 0), j=0..n/i))
        end:
    a:= n-> b(n, 1):
    seq(a(n), n=1..60);  # Alois P. Heinz, Mar 26 2014
  • Mathematica
    (* The following Mathematica program first generates all of the palindromic, unimodal compositions of n and then counts them. *)
    Pal[n_] := Block[{i, j, k, m, Q, L}, If[n == 1, Return[{{1}}]]; If[n == 2, Return[{{1, 1}, {2}}]]; L = {{n}}; If[Mod[n, 2] == 0, L = Append[L, {n/2, n/2}]]; For[i = 1, i < n, i++, Q = Pal[n - 2i]; m = Length[Q]; For[j = 1, j <= m, j++, If[i <= Q[[j, 1]], L = Append[L, Append[Prepend[Q[[j]], i], i]]]]]; L] NoPal[n_] := Length[Pal[n]]
    a[n_] := PartitionsQ[n] + If[EvenQ[n], PartitionsP[n/2], 0]; Table[a[n], {n, 1, 55}] (* Jean-François Alcover, Mar 17 2014, after Vladeta Jovovic *)
    Table[Length[Select[IntegerPartitions[n],And@@EvenQ/@Rest[Length/@Split[#]]&]],{n,1,30}] (* Gus Wiseman, Jan 13 2022 *)
  • PARI
    my(x='x+O('x^66)); Vec(eta(x^2)/eta(x)+1/eta(x^2)-2) \\ Joerg Arndt, Jan 17 2016

Formula

G.f.: sum(j>=1, q^j * (1-q^j)/prod(i=1..j, 1-q^(2*i) ) ).
G.f.: F + G - 2, where F = Product_{j>=1} 1/(1-q^(2*j)), G = Product_{j>=0} 1/(1-q^(2*j+1)).
a(2*n) = A000041(n) + A000009(2*n); a(2*n-1) = A000009(2*n-1). - Vladeta Jovovic, Aug 11 2004
a(n) = A000009(n) + A035363(n) = A000041(n) - A006477(n). - Omar E. Pol, Aug 16 2013

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[#]]&]

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

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

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

A349800 Number of integer compositions of n that are weakly alternating and have at least two adjacent equal parts.

Original entry on oeis.org

0, 0, 1, 1, 4, 9, 16, 33, 62, 113, 205, 373, 664, 1190, 2113, 3744, 6618, 11683, 20564, 36164, 63489, 111343, 195042, 341357, 596892, 1042976, 1821179, 3178145, 5543173, 9663545, 16839321, 29332231, 51075576, 88908912, 154722756, 269186074, 468221264
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.
This sequence counts compositions that are weakly but not strongly alternating; also weakly alternating non-anti-run compositions.

Examples

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

Crossrefs

This is the weakly alternating case of A345192, ranked by A345168.
The case of partitions is A349795, ranked by A350137.
The version counting permutations of prime indices is A349798.
These compositions are ranked by A349799.
A001250 = alternating permutations, ranked by A349051, complement A348615.
A003242 = Carlitz (anti-run) compositions, ranked by A333489.
A025047/A025048/A025049 = alternating compositions, ranked by A345167.
A261983 = non-anti-run compositions, ranked by A348612.
A345165 = partitions without an alternating permutation, ranked by A345171.
A345170 = partitions with an alternating permutation, ranked by A345172.
A345173 = non-alternating anti-run partitions, ranked by A345166.
A345195 = non-alternating anti-run compositions, ranked by A345169.
A348377 = non-alternating non-twin compositions.
A349801 = non-alternating partitions, ranked by A289553.
Weakly alternating:
- A349052 = compositions, directed A129852/A129853, complement A349053.
- A349056 = permutations of prime indices, complement A349797.
- A349057 = complement of standard composition numbers (too dense).
- A349058 = patterns, complement A350138.
- A349059 = ordered factorizations, complement A350139.
- A349060 = partitions, complement A349061.

Programs

  • Mathematica
    wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]==Length[y] &&Length[Split[Sign[Differences[y]]]]==Length[y]-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/@IntegerPartitions[n],(whkQ[#]||whkQ[-#])&&!wigQ[#]&]],{n,0,10}]

Formula

a(n) = A349052(n) - A025047(n). - Andrew Howroyd, Jan 31 2024

Extensions

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

A349797 Number of non-weakly alternating permutations of the multiset of prime factors of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 4, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 6, 0, 0, 0
Offset: 1

Views

Author

Gus Wiseman, Dec 24 2021

Keywords

Comments

First differs from 2 * A326291 at a(90) = 4, A326291(90) = 3.
The first odd term is a(144) = 7, whose non-weakly alternating permutations are shown in the example below.
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.
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 = 30    60     72      120     144      180
   ---------------------------------------------
    235   2235   22332   22235   222332   22353
    532   2352   23223   22352   223223   23235
          2532   23322   22532   223322   23325
          3225   32232   23225   232232   23523
          5223           23522   233222   23532
          5322           25223   322223   25323
                         25322   322322   32235
                         32252            32253
                         52232            32352
                         53222            32532
                                          33225
                                          35223
                                          35322
                                          52233
                                          52332
                                          53223
                                          53232
		

Crossrefs

Counting all permutations of prime factors gives A008480.
Compositions not of this type are counted by A349052/A129852/A129853.
Compositions of this type are counted by A349053, ranked by A349057.
The complement is counted by A349056.
Partitions of this type are counted by A349061, complement A349060.
The version counting patterns is A350138, complement A349058.
The version counting ordered factorizations is A350139, complement A349059.
The strong case is counted by A350251, complement A345164.
Positions of nonzero terms are A350353.
A001250 counts alternating permutations, complement A348615.
A025047 = alternating compositions, ranked by A345167, complement A345192.
A056239 adds up prime indices, row sums of A112798, row lengths A001222.
A071321 gives the alternating sum of prime factors, reverse A071322.
A335452 counts anti-run permutations of prime factors, complement A336107.
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.

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[Permutations[Flatten[ConstantArray@@@ FactorInteger[n]]], !whkQ[#]&&!whkQ[-#]&]],{n,100}]

Formula

a(n) = A008480(n) - A349056(n).
Showing 1-10 of 23 results. Next