cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 13 results. Next

A329312 Length of the co-Lyndon factorization of the binary expansion of n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 10 2019

Keywords

Comments

The co-Lyndon product of two or more finite sequences is defined to be the lexicographically minimal sequence obtainable by shuffling the sequences together. For example, the co-Lyndon product of (231) and (213) is (212313), the product of (221) and (213) is (212213), and the product of (122) and (2121) is (1212122). A co-Lyndon word is a finite sequence that is prime with respect to the co-Lyndon product. Equivalently, a co-Lyndon word is a finite sequence that is lexicographically strictly greater than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into co-Lyndon words, and if these factors are arranged in a certain order, their concatenation is equal to their co-Lyndon product. For example, (1001) has sorted co-Lyndon factorization (1)(100).
Also the length of the Lyndon factorization of the inverted binary expansion of n, where the inverted digits are 1 minus the binary digits.

Examples

			The binary indices of 1..20 together with their co-Lyndon factorizations are:
   1:     (1) = (1)
   2:    (10) = (10)
   3:    (11) = (1)(1)
   4:   (100) = (100)
   5:   (101) = (10)(1)
   6:   (110) = (110)
   7:   (111) = (1)(1)(1)
   8:  (1000) = (1000)
   9:  (1001) = (100)(1)
  10:  (1010) = (10)(10)
  11:  (1011) = (10)(1)(1)
  12:  (1100) = (1100)
  13:  (1101) = (110)(1)
  14:  (1110) = (1110)
  15:  (1111) = (1)(1)(1)(1)
  16: (10000) = (10000)
  17: (10001) = (1000)(1)
  18: (10010) = (100)(10)
  19: (10011) = (100)(1)(1)
  20: (10100) = (10100)
		

Crossrefs

The non-"co" version is A211100.
Positions of 1's are A275692.
The reversed version is A329326.

Programs

  • Mathematica
    colynQ[q_]:=Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    colynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[colynfac[Drop[q,i]],Take[q,i]]]@Last[Select[Range[Length[q]],colynQ[Take[q,#]]&]]];
    Table[Length[colynfac[IntegerDigits[n,2]]],{n,100}]

A329398 Number of compositions of n with uniform Lyndon factorization and uniform co-Lyndon factorization.

Original entry on oeis.org

1, 2, 4, 7, 12, 18, 28, 40, 57, 80, 110, 148, 200, 266, 348, 457, 592, 764, 978, 1248, 1580, 2000, 2508, 3142, 3913
Offset: 1

Views

Author

Gus Wiseman, Nov 13 2019

Keywords

Comments

We define the Lyndon product of two or more finite sequences to be the lexicographically maximal sequence obtainable by shuffling the sequences together. For example, the Lyndon product of (231) with (213) is (232131), the product of (221) with (213) is (222131), and the product of (122) with (2121) is (2122121). A Lyndon word is a finite sequence that is prime with respect to the Lyndon product. Equivalently, a Lyndon word is a finite sequence that is lexicographically strictly less than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into Lyndon words, and if these factors are arranged in lexicographically decreasing order, their concatenation is equal to their Lyndon product. For example, (1001) has sorted Lyndon factorization (001)(1).
Similarly, the co-Lyndon product is the lexicographically minimal sequence obtainable by shuffling the sequences together, and a co-Lyndon word is a finite sequence that is prime with respect to the co-Lyndon product, or, equivalently, a finite sequence that is lexicographically strictly greater than all of its cyclic rotations. For example, (1001) has sorted co-Lyndon factorization (1)(100).
A sequence of words is uniform if they all have the same length.
Conjecture: Also the number of compositions of n that are either weakly increasing or weakly decreasing. Hence a(n) = 2 * A000041(n) - A000005(n). - Gus Wiseman, Mar 05 2020

Examples

			The a(1) = 1 through a(6) = 18 compositions:
  (1)  (2)   (3)    (4)     (5)      (6)
       (11)  (12)   (13)    (14)     (15)
             (21)   (22)    (23)     (24)
             (111)  (31)    (32)     (33)
                    (112)   (41)     (42)
                    (211)   (113)    (51)
                    (1111)  (122)    (114)
                            (221)    (123)
                            (311)    (222)
                            (1112)   (321)
                            (2111)   (411)
                            (11111)  (1113)
                                     (1122)
                                     (2211)
                                     (3111)
                                     (11112)
                                     (21111)
                                     (111111)
		

Crossrefs

Lyndon and co-Lyndon compositions are (both) counted by A059966.
Lyndon compositions that are not weakly increasing are A329141.
Lyndon compositions whose reverse is not co-Lyndon are A329324.

Programs

  • Mathematica
    lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
    lynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[lynfac[Drop[q,i]],Take[q,i]]][Last[Select[Range[Length[q]],lynQ[Take[q,#]]&]]]];
    colynQ[q_]:=Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    colynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[colynfac[Drop[q,i]],Take[q,i]]]@Last[Select[Range[Length[q]],colynQ[Take[q,#]]&]]];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],SameQ@@Length/@lynfac[#]&&SameQ@@Length/@colynfac[#]&]],{n,10}]

Extensions

a(19)-a(25) from Robert Price, Jun 20 2021

A329326 Length of the co-Lyndon factorization of the reversed binary expansion of n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Nov 11 2019

Keywords

Comments

First differs from A211100 at a(77) = 3, A211100(77) = 2. The reversed binary expansion of 77 is (1011001), with co-Lyndon factorization (10)(1100)(1), while the binary expansion is (1001101), with Lyndon factorization of (1)(001101).
The co-Lyndon product of two or more finite sequences is defined to be the lexicographically minimal sequence obtainable by shuffling the sequences together. For example, the co-Lyndon product of (231) and (213) is (212313), the product of (221) and (213) is (212213), and the product of (122) and (2121) is (1212122). A co-Lyndon word is a finite sequence that is prime with respect to the co-Lyndon product. Equivalently, a co-Lyndon word is a finite sequence that is lexicographically strictly greater than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into co-Lyndon words, and if these factors are arranged in certain order, their concatenation is equal to their co-Lyndon product. For example, (1001) has sorted co-Lyndon factorization (1)(100).

Examples

			The reversed binary expansion of each positive integer together with their co-Lyndon factorizations begins:
   1:     (1) = (1)
   2:    (01) = (0)(1)
   3:    (11) = (1)(1)
   4:   (001) = (0)(0)(1)
   5:   (101) = (10)(1)
   6:   (011) = (0)(1)(1)
   7:   (111) = (1)(1)(1)
   8:  (0001) = (0)(0)(0)(1)
   9:  (1001) = (100)(1)
  10:  (0101) = (0)(10)(1)
  11:  (1101) = (110)(1)
  12:  (0011) = (0)(0)(1)(1)
  13:  (1011) = (10)(1)(1)
  14:  (0111) = (0)(1)(1)(1)
  15:  (1111) = (1)(1)(1)(1)
  16: (00001) = (0)(0)(0)(0)(1)
  17: (10001) = (1000)(1)
  18: (01001) = (0)(100)(1)
  19: (11001) = (1100)(1)
  20: (00101) = (0)(0)(10)(1)
		

Crossrefs

The non-"co" version is A211100.
Positions of 2's are A329357.
Numbers whose binary expansion is co-Lyndon are A275692.
Length of the co-Lyndon factorization of the binary expansion is A329312.

Programs

  • Mathematica
    colynQ[q_]:=Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    colynfac[q_]:=If[Length[q]==0,{},Function[i,Prepend[colynfac[Drop[q,i]],Take[q,i]]]@Last[Select[Range[Length[q]],colynQ[Take[q,#]]&]]];
    Table[Length[colynfac[Reverse[IntegerDigits[n,2]]]],{n,100}]

A329318 List of co-Lyndon words on {1,2} sorted first by length and then lexicographically.

Original entry on oeis.org

1, 2, 21, 211, 221, 2111, 2211, 2221, 21111, 21211, 22111, 22121, 22211, 22221, 211111, 212111, 221111, 221121, 221211, 222111, 222121, 222211, 222221, 2111111, 2112111, 2121111, 2121211, 2211111, 2211121, 2211211, 2212111, 2212121, 2212211, 2221111, 2221121
Offset: 1

Views

Author

Gus Wiseman, Nov 11 2019

Keywords

Comments

The co-Lyndon product of two or more finite sequences is defined to be the lexicographically minimal sequence obtainable by shuffling the sequences together. For example, the co-Lyndon product of (231) and (213) is (212313), the product of (221) and (213) is (212213), and the product of (122) and (2121) is (1212122). A co-Lyndon word is a finite sequence that is prime with respect to the co-Lyndon product. Equivalently, a co-Lyndon word is a finite sequence that is lexicographically strictly greater than all of its cyclic rotations. Every finite sequence has a unique (orderless) factorization into co-Lyndon words, and if these factors are arranged in a certain order, their concatenation is equal to their co-Lyndon product. For example, (1001) has sorted co-Lyndon factorization (1)(100).

Crossrefs

The non-"co" version is A102659.
Numbers whose binary expansion is co-Lyndon are A275692.
Length of the co-Lyndon factorization of the binary expansion is A329312.

Programs

  • Mathematica
    colynQ[q_]:=Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    Join@@Table[FromDigits/@Select[Tuples[{1,2},n],colynQ],{n,5}]

A281013 Tetrangle T(n,k,i) = i-th part of k-th prime composition of n.

Original entry on oeis.org

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

Views

Author

Gus Wiseman, Jan 12 2017

Keywords

Comments

The *-product of two or more finite sequences is defined to be the lexicographically minimal sequence obtainable by shuffling them together. Every finite positive integer sequence has a unique *-factorization using prime compositions P = {(1), (2), (21), (3), (211), ...}. See A060223 and A228369 for details.
These are co-Lyndon compositions, ordered first by sum and then lexicographically. - Gus Wiseman, Nov 15 2019

Examples

			The prime factorization of (1, 1, 4, 2, 3, 1, 5, 5) is: (11423155) = (1)*(1)*(5)*(5)*(4231). The prime factorizations of the initial terms of A000002 are:
             (1) = (1)
            (12) = (1)*(2)
           (122) = (1)*(2)*(2)
          (1221) = (1)*(221)
         (12211) = (1)*(2211)
        (122112) = (1)*(2)*(2211)
       (1221121) = (1)*(221121)
      (12211212) = (1)*(2)*(221121)
     (122112122) = (1)*(2)*(2)*(221121)
    (1221121221) = (1)*(221)*(221121)
   (12211212212) = (1)*(2)*(221)*(221121)
  (122112122122) = (1)*(2)*(2)*(221)*(221121).
Read as a sequence:
(1), (2), (21), (3), (211), (31), (4), (2111), (221), (311), (32), (41), (5).
Read as a triangle:
(1)
(2)
(21), (3)
(211), (31), (4)
(2111), (221), (311), (32), (41), (5).
Read as a sequence of triangles:
1    2    2 1    2 1 1    2 1 1 1    2 1 1 1 1    2 1 1 1 1 1
          3      3 1      2 2 1      2 2 1 1      2 1 2 1 1
                 4        3 1 1      3 1 1 1      2 2 1 1 1
                          3 2        3 1 2        2 2 2 1
                          4 1        3 2 1        3 1 1 1 1
                          5          4 1 1        3 1 1 2
                                     4 2          3 1 2 1
                                     5 1          3 2 1 1
                                     6            3 2 2
                                                  3 3 1
                                                  4 1 1 1
                                                  4 1 2
                                                  4 2 1
                                                  4 3
                                                  5 1 1
                                                  5 2
                                                  6 1
                                                  7.
		

Crossrefs

The binary version is A329318.
The binary non-"co" version is A102659.
A sequence listing all Lyndon compositions is A294859.
Numbers whose binary expansion is co-Lyndon are A328596.
Numbers whose binary expansion is co-Lyndon are A275692.
Binary Lyndon words are A001037.
Lyndon compositions are A059966.
Normal Lyndon words are A060223.

Programs

  • Mathematica
    colynQ[q_]:=Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    lexsort[f_,c_]:=OrderedQ[PadRight[{f,c}]];
    Table[Sort[Select[Join@@Permutations/@IntegerPartitions[n],colynQ],lexsort],{n,5}] (* Gus Wiseman, Nov 15 2019 *)

Formula

Row lengths are A059966(n) = number of prime compositions of n.

A334266 Numbers k such that the k-th composition in standard order is both a reversed Lyndon word and a co-Lyndon word.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 9, 11, 16, 17, 18, 19, 21, 23, 32, 33, 34, 35, 37, 39, 43, 47, 64, 65, 66, 67, 68, 69, 71, 73, 74, 75, 77, 79, 85, 87, 91, 95, 128, 129, 130, 131, 132, 133, 135, 137, 138, 139, 141, 143, 146, 147, 149, 151, 155, 159, 171, 173, 175, 183, 191
Offset: 1

Views

Author

Gus Wiseman, Apr 22 2020

Keywords

Comments

A Lyndon word is a finite sequence of positive integers that is lexicographically strictly less than all of its cyclic rotations. Co-Lyndon is defined similarly, except with strictly greater instead of strictly less.
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 of all reversed Lyndon co-Lyndon words begins:
    0: ()            37: (3,2,1)         91: (2,1,2,1,1)
    1: (1)           39: (3,1,1,1)       95: (2,1,1,1,1,1)
    2: (2)           43: (2,2,1,1)      128: (8)
    4: (3)           47: (2,1,1,1,1)    129: (7,1)
    5: (2,1)         64: (7)            130: (6,2)
    8: (4)           65: (6,1)          131: (6,1,1)
    9: (3,1)         66: (5,2)          132: (5,3)
   11: (2,1,1)       67: (5,1,1)        133: (5,2,1)
   16: (5)           68: (4,3)          135: (5,1,1,1)
   17: (4,1)         69: (4,2,1)        137: (4,3,1)
   18: (3,2)         71: (4,1,1,1)      138: (4,2,2)
   19: (3,1,1)       73: (3,3,1)        139: (4,2,1,1)
   21: (2,2,1)       74: (3,2,2)        141: (4,1,2,1)
   23: (2,1,1,1)     75: (3,2,1,1)      143: (4,1,1,1,1)
   32: (6)           77: (3,1,2,1)      146: (3,3,2)
   33: (5,1)         79: (3,1,1,1,1)    147: (3,3,1,1)
   34: (4,2)         85: (2,2,2,1)      149: (3,2,2,1)
   35: (4,1,1)       87: (2,2,1,1,1)    151: (3,2,1,1,1)
		

Crossrefs

The version for binary expansion is A334267.
Compositions of this type are counted by A334269.
Normal sequences of this type are counted by A334270.
Necklace compositions of this type are counted by A334271.
Binary Lyndon words are counted by A001037.
Lyndon compositions are counted by A059966.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Necklaces are A065609.
- Sum is A070939.
- Reverse is A228351 (triangle).
- Strict compositions are A233564.
- Constant compositions are A272919.
- Lyndon words are A275692.
- Reversed Lyndon words are A334265.
- Co-Lyndon words are A326774.
- Reversed co-Lyndon words are A328596.
- Length of Lyndon factorization is A329312.
- Length of Lyndon factorization of reverse is A334297.
- Length of co-Lyndon factorization is A334029.
- Length of co-Lyndon factorization of reverse is A329313.
- Distinct rotations are counted by A333632.
- Co-Lyndon factorizations are counted by A333765.
- Lyndon factorizations are counted by A333940.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    lynQ[q_]:=Length[q]==0||Array[Union[{q,RotateRight[q,#1]}]=={q,RotateRight[q,#1]}&,Length[q]-1,1,And];
    colynQ[q_]:=Length[q]==0||Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    Select[Range[0,100],lynQ[Reverse[stc[#]]]&&colynQ[stc[#]]&]

Formula

Intersection of A334265 and A326774.

A334269 Number of compositions of n that are both a reversed Lyndon word and a co-Lyndon word.

Original entry on oeis.org

1, 1, 2, 3, 6, 8, 16, 23, 40, 62, 110, 169, 302, 492, 856, 1454, 2572, 4428, 7914, 13935, 25036, 44842, 81298, 147149, 268952, 491746, 904594, 1667091, 3085950, 5723367, 10652544, 19865887, 37150314, 69608939, 130723184, 245935633, 463590444, 875306913, 1655451592, 3135613649, 5948011978, 11298215516
Offset: 1

Views

Author

Gus Wiseman, Apr 24 2020

Keywords

Comments

Also the number of compositions of n that are both a Lyndon word and a reversed co-Lyndon word.
A composition of n is a finite sequence of positive integers summing to n.
A Lyndon word is a finite sequence of positive integers that is lexicographically strictly less than all of its cyclic rotations. Co-Lyndon is defined similarly, except with strictly greater instead of strictly less.

Examples

			The a(1) = 1 through a(7) = 16 compositions:
  (1)  (2)  (3)   (4)    (5)     (6)      (7)
            (21)  (31)   (32)    (42)     (43)
                  (211)  (41)    (51)     (52)
                         (221)   (321)    (61)
                         (311)   (411)    (322)
                         (2111)  (2211)   (331)
                                 (3111)   (421)
                                 (21111)  (511)
                                          (2221)
                                          (3121)
                                          (3211)
                                          (4111)
                                          (21211)
                                          (22111)
                                          (31111)
                                          (211111)
		

Crossrefs

The version for binary expansion is A334267.
Compositions of this type are ranked by A334266.
Normal sequences of this type are counted by A334270.
Necklace compositions of this type are counted by A334271.
Aperiodic compositions are counted by A000740.
Binary Lyndon words are counted by A001037.
Necklace compositions are counted by A008965.
Normal Lyndon words are counted by A060223.
Lyndon compositions are counted by A059966.
All of the following pertain to compositions in standard order (A066099):
- Lyndon words are A275692.
- Co-Lyndon words are A326774.
- Reversed Lyndon words are A334265.
- Reversed co-Lyndon words are A328596.
- Length of Lyndon factorization is A329312.
- Length of co-Lyndon factorization is A334029.
- Length of Lyndon factorization of reverse is A334297.
- Length of co-Lyndon factorization of reverse is A329313.
- Lyndon factorizations are counted by A333940.
- Co-Lyndon factorizations are counted by A333765.
- Aperiodic compositions are A328594.
- Distinct rotations are counted by A333632.

Programs

  • Mathematica
    lynQ[q_]:=Length[q]==0||Array[Union[{q,RotateRight[q,#1]}]=={q,RotateRight[q,#1]}&,Length[q]-1,1,And];
    colynQ[q_]:=Length[q]==0||Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],lynQ[Reverse[#]]&&colynQ[#]&]],{n,0,15}]

Extensions

Offset corrected and a(21)-a(42) from Bert Dobbelaere, Apr 26 2020

A334271 Number of compositions of n that are both a reversed necklace and a co-necklace.

Original entry on oeis.org

1, 1, 2, 3, 5, 7, 12, 17, 28, 43, 70, 111, 184, 303, 510, 865, 1482, 2573, 4480, 7915, 14008
Offset: 0

Views

Author

Gus Wiseman, Apr 25 2020

Keywords

Comments

Also the number of compositions of n that are both a necklace and a reversed co-necklace.
A necklace is a finite sequence of positive integers that is lexicographically less than or equal to any cyclic rotation. Co-necklace is defined similarly, except with greater instead of less.

Examples

			The a(1) = 1 through a(6) = 12 compositions:
  (1)  (2)   (3)    (4)     (5)      (6)
       (11)  (21)   (22)    (32)     (33)
             (111)  (31)    (41)     (42)
                    (211)   (221)    (51)
                    (1111)  (311)    (222)
                            (2111)   (321)
                            (11111)  (411)
                                     (2121)
                                     (2211)
                                     (3111)
                                     (21111)
                                     (111111)
		

Crossrefs

Normal sequences of this type are counted by A334272.
The aperiodic case is A334269.
These compositions are ranked by A334273.
Binary (or reversed binary) necklaces are counted by A000031.
Normal sequences are counted by A000670.
Necklace compositions are counted by A008965.
Lyndon compositions are counted by A059966.
Normal Lyndon words are counted by A060223.
Normal necklaces are counted by A019536.
Normal aperiodic words are counted by A296975.
All of the following pertain to compositions in standard order (A066099):
- Necklaces are A065609.
- Reversed necklaces are A333943.
- Co-necklaces are A333764.
- Reversed co-necklaces are A328595.
- Lyndon words are A275692.
- Co-Lyndon words are A326774.
- Reversed Lyndon words are A334265.
- Reversed co-Lyndon words are A328596.
- Aperiodic compositions are A328594.

Programs

  • Mathematica
    neckQ[q_]:=Length[q]==0||Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
    coneckQ[q_]:=Length[q]==0||Array[OrderedQ[{RotateRight[q,#],q}]&,Length[q]-1,1,And];
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],neckQ[Reverse[#]]&&coneckQ[#]&]],{n,0,15}]

A334267 Numbers k such that the k-th composition in standard order is both a Lyndon word and a reversed co-Lyndon word.

Original entry on oeis.org

0, 1, 2, 4, 6, 8, 12, 14, 16, 20, 24, 26, 28, 30, 32, 40, 48, 52, 56, 58, 60, 62, 64, 72, 80, 84, 96, 100, 104, 106, 108, 112, 116, 118, 120, 122, 124, 126, 128, 144, 160, 164, 168, 192, 200, 208, 212, 216, 218, 224, 228, 232, 234, 236, 240, 244, 246, 248, 250
Offset: 1

Views

Author

Gus Wiseman, Apr 22 2020

Keywords

Comments

Also numbers whose binary expansion is both a reversed Lyndon word and a co-Lyndon word.
A Lyndon word is a finite sequence of positive integers that is lexicographically strictly less than all of its cyclic rotations. Co-Lyndon is defined similarly, except with strictly greater instead of strictly less.
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 of all reversed co-Lyndon Lyndon words begins:
    0: ()            56: (1,1,4)        124: (1,1,1,1,3)
    1: (1)           58: (1,1,2,2)      126: (1,1,1,1,1,2)
    2: (2)           60: (1,1,1,3)      128: (8)
    4: (3)           62: (1,1,1,1,2)    144: (3,5)
    6: (1,2)         64: (7)            160: (2,6)
    8: (4)           72: (3,4)          164: (2,3,3)
   12: (1,3)         80: (2,5)          168: (2,2,4)
   14: (1,1,2)       84: (2,2,3)        192: (1,7)
   16: (5)           96: (1,6)          200: (1,3,4)
   20: (2,3)        100: (1,3,3)        208: (1,2,5)
   24: (1,4)        104: (1,2,4)        212: (1,2,2,3)
   26: (1,2,2)      106: (1,2,2,2)      216: (1,2,1,4)
   28: (1,1,3)      108: (1,2,1,3)      218: (1,2,1,2,2)
   30: (1,1,1,2)    112: (1,1,5)        224: (1,1,6)
   32: (6)          116: (1,1,2,3)      228: (1,1,3,3)
   40: (2,4)        118: (1,1,2,1,2)    232: (1,1,2,4)
   48: (1,5)        120: (1,1,1,4)      234: (1,1,2,2,2)
   52: (1,2,3)      122: (1,1,1,2,2)    236: (1,1,2,1,3)
The sequence of terms together with their binary expansions and binary indices begins:
    0:      0 ~ {}            56:  111000 ~ {4,5,6}
    1:      1 ~ {1}           58:  111010 ~ {2,4,5,6}
    2:     10 ~ {2}           60:  111100 ~ {3,4,5,6}
    4:    100 ~ {3}           62:  111110 ~ {2,3,4,5,6}
    6:    110 ~ {2,3}         64: 1000000 ~ {7}
    8:   1000 ~ {4}           72: 1001000 ~ {4,7}
   12:   1100 ~ {3,4}         80: 1010000 ~ {5,7}
   14:   1110 ~ {2,3,4}       84: 1010100 ~ {3,5,7}
   16:  10000 ~ {5}           96: 1100000 ~ {6,7}
   20:  10100 ~ {3,5}        100: 1100100 ~ {3,6,7}
   24:  11000 ~ {4,5}        104: 1101000 ~ {4,6,7}
   26:  11010 ~ {2,4,5}      106: 1101010 ~ {2,4,6,7}
   28:  11100 ~ {3,4,5}      108: 1101100 ~ {3,4,6,7}
   30:  11110 ~ {2,3,4,5}    112: 1110000 ~ {5,6,7}
   32: 100000 ~ {6}          116: 1110100 ~ {3,5,6,7}
   40: 101000 ~ {4,6}        118: 1110110 ~ {2,3,5,6,7}
   48: 110000 ~ {5,6}        120: 1111000 ~ {4,5,6,7}
   52: 110100 ~ {3,5,6}      122: 1111010 ~ {2,4,5,6,7}
		

Crossrefs

Compositions of this type are counted by A334269.
Normal sequences of this type are counted by A334270.
Necklaces of this type are counted by A334271.
Necklaces of this type are ranked by A334274.
Binary (or reversed binary) Lyndon words are counted by A001037.
Lyndon compositions are counted by A059966.
Lyndon words whose reverse is not co-Lyndon are counted by A329324
Reversed Lyndon co-Lyndon compositions are ranked by A334266.
All of the following pertain to compositions in standard order (A066099):
- Length is A000120.
- Necklaces are A065609.
- Sum is A070939.
- Reverse is A228351 (triangle).
- Strict compositions are A233564.
- Constant compositions are A272919.
- Lyndon words are A275692.
- Reversed Lyndon words are A334265.
- Co-Lyndon words are A326774.
- Reversed co-Lyndon words are A328596.
- Length of Lyndon factorization is A329312.
- Length of Lyndon factorization of reverse is A334297.
- Length of co-Lyndon factorization is A334029.
- Length of co-Lyndon factorization of reverse is A329313.
- Distinct rotations are counted by A333632.
- Lyndon factorizations are counted by A333940.
- Co-Lyndon factorizations are counted by A333765.

Programs

  • Mathematica
    stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
    lynQ[q_]:=Length[q]==0||Array[Union[{q,RotateRight[q,#1]}]=={q,RotateRight[q,#1]}&,Length[q]-1,1,And];
    colynQ[q_]:=Length[q]==0||Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    Select[Range[0,100],colynQ[Reverse[stc[#]]]&&lynQ[stc[#]]&]

Formula

Intersection of A275692 and A328596.

A334270 Number of sequences of length n that cover an initial interval of positive integers and are both a reversed Lyndon word and a co-Lyndon word.

Original entry on oeis.org

1, 1, 1, 3, 10, 42, 224, 1505, 12380, 120439
Offset: 0

Views

Author

Gus Wiseman, Apr 24 2020

Keywords

Comments

Also the number of sequences of length n that cover an initial interval of positive integers and are both a Lyndon word and a reversed co-Lyndon word.
A Lyndon word is a finite sequence of positive integers that is lexicographically strictly less than all of its cyclic rotations. Co-Lyndon is defined similarly, except with strictly greater instead of strictly less.

Examples

			The a(1) = 1 through a(4) = 10 normal sequences:
  (1)  (2,1)  (2,1,1)  (2,1,1,1)
              (2,2,1)  (2,2,1,1)
              (3,2,1)  (2,2,2,1)
                       (3,1,2,1)
                       (3,2,1,1)
                       (3,2,2,1)
                       (3,2,3,1)
                       (3,3,2,1)
                       (4,2,3,1)
                       (4,3,2,1)
		

Crossrefs

These compositions are ranked by A334266 (standard) and A334267 (binary).
Compositions of this type are counted by A334269.
Necklace compositions of this type are counted by A334271.
Dominated by A334272 (the necklace version).
Normal sequences are counted by A000670.
Binary (or reversed binary) Lyndon words are counted by A001037.
Lyndon compositions are counted by A059966.
Normal Lyndon words are counted by A060223.
Normal sequences by length and Lyndon factorization length are A296372.
All of the following pertain to compositions in standard order (A066099):
- Lyndon words are A275692.
- Co-Lyndon words are A326774.
- Reversed Lyndon words are A334265.
- Reversed co-Lyndon words are A328596.
- Length of Lyndon factorization is A329312.
- Length of co-Lyndon factorization is A334029.
- Length of Lyndon factorization of reverse is A334297.
- Length of co-Lyndon factorization of reverse is A329313.

Programs

  • Mathematica
    lynQ[q_]:=Length[q]==0||Array[Union[{q,RotateRight[q,#1]}]=={q,RotateRight[q,#1]}&,Length[q]-1,1,And];
    colynQ[q_]:=Length[q]==0||Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
    allnorm[n_]:=If[n<=0,{{}},Function[s,Array[Count[s,y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1]];
    Table[Length[Select[Join@@Permutations/@allnorm[n],lynQ[Reverse[#]]&&colynQ[#]&]],{n,0,6}]
Showing 1-10 of 13 results. Next