A296658
Length of the standard Lyndon word factorization of the first n terms of A000002.
Original entry on oeis.org
1, 1, 1, 2, 3, 2, 3, 2, 2, 3, 2, 2, 3, 4, 3, 4, 5, 4, 3, 4, 3, 4, 5, 4, 5, 3, 3, 4, 5, 4, 5, 6, 5, 6, 4, 4, 5, 4, 4, 5, 6, 5, 6, 4, 4, 5, 4, 5, 6, 5, 6, 7, 6, 4, 5, 4, 4, 5, 6, 5, 6, 4, 4, 5, 4, 4, 5, 6, 5, 6, 7, 6, 7, 5, 5, 6, 5, 6, 7, 6, 5, 6, 5, 5, 6, 7, 6
Offset: 1
The standard Lyndon word factorization of (12211212212211211) is (122)(112122122)(112)(1)(1), so a(17) = 5.
The standard factorizations of initial terms of A000002:
1
12
122
122,1
122,1,1
122,112
122,112,1
122,11212
122,112122
122,112122,1
122,11212212
122,112122122
122,112122122,1
122,112122122,1,1
122,112122122,112
122,112122122,112,1
122,112122122,112,1,1
122,112122122,112,112
122,112122122,1121122
122,112122122,1121122,1
Cf.
A000002,
A001037,
A027375,
A060223,
A088568,
A102659,
A211100,
A281013,
A288605,
A296372,
A296657,
A296659,
A328596,
A329312,
A329316,
A329317.
-
LyndonQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And]&&Array[RotateRight[q,#]&,Length[q],1,UnsameQ];
qit[q_]:=If[#===Length[q],{q},Prepend[qit[Drop[q,#]],Take[q,#]]]&[Max@@Select[Range[Length[q]],LyndonQ[Take[q,#]]&]];
kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],Part[q,-2],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]];
Table[Length[qit[Nest[kolagrow,1,n]]],{n,150}]
A333940
Number of Lyndon factorizations of the k-th composition in standard order.
Original entry on oeis.org
1, 1, 1, 2, 1, 2, 1, 3, 1, 2, 2, 4, 1, 2, 1, 5, 1, 2, 2, 4, 1, 4, 2, 7, 1, 2, 1, 4, 1, 2, 1, 7, 1, 2, 2, 4, 2, 5, 2, 7, 1, 2, 3, 9, 2, 5, 2, 12, 1, 2, 1, 4, 1, 2, 2, 7, 1, 2, 1, 4, 1, 2, 1, 11, 1, 2, 2, 4, 2, 5, 2, 7, 1, 4, 4, 11, 2, 5, 2, 12, 1, 2, 2, 4, 1, 7
Offset: 0
We have a(300) = 5, because the 300th composition (3,2,1,3) has the following Lyndon factorizations:
((3,2,1,3))
((1,3),(3,2))
((2),(3,1,3))
((3),(2,1,3))
((2),(3),(1,3))
Binary necklaces are counted by
A000031.
Necklace compositions are counted by
A008965.
Necklaces covering an initial interval are counted by
A019536.
Lyndon compositions are counted by
A059966.
Numbers whose reversed binary expansion is a necklace are
A328595.
Numbers whose prime signature is a necklace are
A329138.
Length of Lyndon factorization of binary expansion is
A211100.
Length of co-Lyndon factorization of binary expansion is
A329312.
Length of co-Lyndon factorization of reversed binary expansion is
A329326.
Length of Lyndon factorization of reversed binary expansion is
A329313.
All of the following pertain to compositions in standard order (
A066099):
- Rotational symmetries are counted by
A138904.
- Constant compositions are
A272919.
- Co-Lyndon compositions are
A326774.
- Aperiodic compositions are
A328594.
- Reversed co-necklaces are
A328595.
- Length of Lyndon factorization is
A329312.
- Length of co-Lyndon factorization is
A334029.
- Combinatory separations are
A334030.
-
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
lynprod[]:={};lynprod[{},b_List]:=b;lynprod[a_List,{}]:=a;lynprod[a_List]:=a;
lynprod[{x_,a___},{y_,b___}]:=Switch[Ordering[If[x=!=y,{x,y},{lynprod[{a},{x,b}],lynprod[{x,a},{b}]}]],{2,1},Prepend[lynprod[{a},{y,b}],x],{1,2},Prepend[lynprod[{x,a},{b}],y]];
lynprod[a_List,b_List,c__List]:=lynprod[a,lynprod[b,c]];
sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]&/@sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
dealings[q_]:=Union[Function[ptn,Sort[q[[#]]&/@ptn]]/@sps[Range[Length[q]]]];
Table[Length[Select[dealings[stc[n]],lynprod@@#==stc[n]&]],{n,0,100}]
A329315
Irregular triangle read by rows where row n gives the sequence of lengths of components of the Lyndon factorization of the first n terms of A000002.
Original entry on oeis.org
1, 2, 3, 3, 1, 3, 1, 1, 3, 3, 3, 3, 1, 3, 5, 3, 6, 3, 6, 1, 3, 8, 3, 9, 3, 9, 1, 3, 9, 1, 1, 3, 9, 3, 3, 9, 3, 1, 3, 9, 3, 1, 1, 3, 9, 3, 3, 3, 9, 7, 3, 9, 7, 1, 3, 9, 9, 3, 9, 9, 1, 3, 9, 9, 1, 1, 3, 9, 9, 3, 3, 9, 9, 3, 1, 3, 9, 14, 3, 9, 15, 3, 9, 15, 1, 3
Offset: 1
Triangle begins:
1: (1)
2: (2)
3: (3)
4: (3,1)
5: (3,1,1)
6: (3,3)
7: (3,3,1)
8: (3,5)
9: (3,6)
10: (3,6,1)
11: (3,8)
12: (3,9)
13: (3,9,1)
14: (3,9,1,1)
15: (3,9,3)
16: (3,9,3,1)
17: (3,9,3,1,1)
18: (3,9,3,3)
19: (3,9,7)
20: (3,9,7,1)
For example, the first 10 terms of A000002 are (1221121221), with Lyndon factorization (122)(112122)(1), so row 10 is (3,6,1).
Cf.
A000002,
A000031,
A001037,
A027375,
A059966,
A060223,
A088568,
A102659,
A211100,
A288605,
A296372,
A329314,
A329317,
A329325.
-
lynQ[q_]:=Array[Union[{q,RotateRight[q,#1]}]=={q,RotateRight[q,#1]}&,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,#1]]&]]]];
kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]];
kol[n_Integer]:=Nest[kolagrow,{1},n-1];
Table[Length/@lynfac[kol[n]],{n,100}]
A323870
Number of toroidal necklaces of size n whose entries cover an initial interval of positive integers.
Original entry on oeis.org
1, 4, 10, 61, 218, 3136, 13514, 272998, 2362439, 40899248, 295024106, 14045787790, 81055130522, 3040383719360, 61408850927732, 1661142088494553, 15337737297545402, 1128511554421317128, 9768588138876674858, 803306338873366385030, 15452347618762680757428
Offset: 1
The a(3) = 10 toroidal necklaces:
[1 2 3] [1 3 2] [1 2 2] [1 1 2] [1 1 1]
.
[1] [1] [1] [1] [1]
[2] [3] [2] [1] [1]
[3] [2] [2] [2] [1]
-
sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]&/@sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
nrmmats[n_]:=Join@@Table[Table[Table[Position[stn,{i,j}][[1,1]],{i,d},{j,n/d}],{stn,Join@@Permutations/@sps[Tuples[{Range[d],Range[n/d]}]]}],{d,Divisors[n]}];
neckmatQ[m_]:=m==First[Union@@Table[RotateLeft[m,{i,j}],{i,Length[m]},{j,Length[First[m]]}]];
Table[Length[Select[nrmmats[n],neckmatQ]],{n,6}]
-
U(n,m,k) = (1/(n*m)) * sumdiv(n, c, sumdiv(m, d, eulerphi(c) * eulerphi(d) * k^(n*m/lcm(c, d))));
R(v)={sum(n=1, #v, sum(k=1, n, (-1)^(n-k)*binomial(n,k)*v[k]))}
a(n)={if(n < 1, n==0, R(vector(n, k, sumdiv(n, d, U(d, n/d, k))) ))} \\ Andrew Howroyd, Aug 18 2019
A329324
Number of Lyndon compositions of n whose reverse is not a co-Lyndon composition.
Original entry on oeis.org
0, 0, 0, 0, 0, 1, 2, 7, 16, 37, 76, 166, 328, 669, 1326, 2626, 5138, 10104, 19680, 38442, 74822, 145715, 283424, 551721, 1073224
Offset: 1
The a(6) = 1 through a(9) = 16 compositions:
(132) (142) (143) (153)
(1132) (152) (162)
(1142) (243)
(1232) (1143)
(1322) (1152)
(11132) (1242)
(11312) (1332)
(1422)
(11142)
(11232)
(11322)
(11412)
(12132)
(111132)
(111312)
(112212)
Lyndon and co-Lyndon compositions are counted by
A059966.
Numbers whose reversed binary expansion is Lyndon are
A328596.
Numbers whose binary expansion is co-Lyndon are
A275692.
Lyndon compositions that are not weakly increasing are
A329141.
Cf.
A000740,
A001037,
A008965,
A060223,
A102659,
A211100,
A329131,
A329312,
A329313,
A329318,
A329326.
-
lynQ[q_]:=Array[Union[{q,RotateRight[q,#1]}]=={q,RotateRight[q,#1]}&,Length[q]-1,1,And];
colynQ[q_]:=Array[Union[{RotateRight[q,#1],q}]=={RotateRight[q,#1],q}&,Length[q]-1,1,And];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],lynQ[#]&&!colynQ[Reverse[#]]&]],{n,15}]
A333765
Number of co-Lyndon factorizations of the k-th composition in standard order.
Original entry on oeis.org
1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 2, 2, 4, 5, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 4, 2, 4, 4, 7, 7, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 3, 1, 2, 2, 2, 1, 2, 2, 2, 2, 5, 2, 5, 2, 4, 4, 9, 4, 7, 7, 12, 11, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 4, 1
Offset: 0
The a(54) = 5, a(61) = 7, and a(237) = 9 factorizations:
((1,2,1,2)) ((1,1,1,2,1)) ((1,1,2,1,2,1))
((1),(2,1,2)) ((1),(1,1,2,1)) ((1),(1,2,1,2,1))
((1,2),(2,1)) ((1,1),(1,2,1)) ((1,1),(2,1,2,1))
((2),(1,2,1)) ((2,1),(1,1,1)) ((1,2,1),(1,2,1))
((1),(2),(2,1)) ((1),(1),(1,2,1)) ((2,1),(1,1,2,1))
((1),(1,1),(2,1)) ((1),(1),(2,1,2,1))
((1),(1),(1),(2,1)) ((1,1),(2,1),(2,1))
((1),(2,1),(1,2,1))
((1),(1),(2,1),(2,1))
Binary necklaces are counted by
A000031.
Necklace compositions are counted by
A008965.
Necklaces covering an initial interval are counted by
A019536.
Lyndon compositions are counted by
A059966.
Numbers whose reversed binary expansion is a necklace are
A328595.
Numbers whose prime signature is a necklace are
A329138.
Length of Lyndon factorization of binary expansion is
A211100.
Length of co-Lyndon factorization of binary expansion is
A329312.
Length of co-Lyndon factorization of reversed binary expansion is
A329326.
Length of Lyndon factorization of reversed binary expansion is
A329313.
All of the following pertain to compositions in standard order (
A066099):
- Rotational symmetries are counted by
A138904.
- Constant compositions are
A272919.
- Co-Lyndon compositions are
A326774.
- Aperiodic compositions are
A328594.
- Reversed co-necklaces are
A328595.
- Length of Lyndon factorization is
A329312.
- Length of co-Lyndon factorization is
A334029.
- Combinatory separations are
A334030.
-
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
colynprod[]:={};colynprod[{},b_List]:=b;colynprod[a_List,{}]:=a;colynprod[a_List]:=a;
colynprod[{x_,a___},{y_,b___}]:=Switch[Ordering[If[x=!=y,{x,y},{colynprod[{a},{x,b}],colynprod[{x,a},{b}]}]],{1,2},Prepend[colynprod[{a},{y,b}],x],{2,1},Prepend[colynprod[{x,a},{b}],y]];
colynprod[a_List,b_List,c__List]:=colynprod[a,colynprod[b,c]];
sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]&/@sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
dealings[q_]:=Union[Function[ptn,Sort[q[[#]]&/@ptn]]/@sps[Range[Length[q]]]];
Table[Length[Select[dealings[stc[n]],colynprod@@#==stc[n]&]],{n,0,100}]
A294859
Triangle whose n-th row is the concatenated sequence of all Lyndon compositions of n in lexicographic order.
Original entry on oeis.org
1, 2, 1, 2, 3, 1, 1, 2, 1, 3, 4, 1, 1, 1, 2, 1, 1, 3, 1, 2, 2, 1, 4, 2, 3, 5, 1, 1, 1, 1, 2, 1, 1, 1, 3, 1, 1, 2, 2, 1, 1, 4, 1, 2, 3, 1, 3, 2, 1, 5, 2, 4, 6, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 2, 2, 1, 1, 1, 4, 1, 1, 2, 1, 2, 1, 1, 2, 3, 1, 1, 3, 2, 1
Offset: 1
Triangle of Lyndon compositions begins:
(1),
(2),
(12),(3),
(112),(13),(4),
(1112),(113),(122),(14),(23),(5),
(11112),(1113),(1122),(114),(123),(132),(15),(24),(6),
(111112),(11113),(11122),(1114),(11212),(1123),(1132),(115),(1213),(1222),(124),(133),(142),(16),(223),(25),(34),(7).
Cf.
A000740,
A001037,
A001045,
A008965,
A059966,
A060223,
A066099,
A101211,
A102659,
A124734,
A185700,
A228369,
A281013,
A296302,
A296373,
A296656.
-
LyndonQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And]&&Array[RotateRight[q,#]&,Length[q],1,UnsameQ];
Table[Sort[Select[Join@@Permutations/@IntegerPartitions[n],LyndonQ],OrderedQ[PadRight[{#1,#2}]]&],{n,7}]
A323871
Number of aperiodic toroidal necklaces of size n whose entries cover an initial interval of positive integers.
Original entry on oeis.org
1, 2, 8, 53, 216, 3112, 13512, 272844, 2362412, 40898808, 295024104, 14045779864, 81055130520, 3040383692328, 61408850927280, 1661142087743940, 15337737297545400, 1128511554416582908, 9768588138876674856, 803306338873264137240, 15452347618762680730384
Offset: 1
The a(3) = 8 aperiodic toroidal necklaces:
[1 2 3] [1 3 2] [1 2 2] [1 1 2]
.
[1] [1] [1] [1]
[2] [3] [2] [1]
[3] [2] [2] [2]
-
List([1..30], A323871); # See A323861 for code; Andrew Howroyd, Aug 21 2019
-
sps[{}]:={{}};sps[set:{i_,_}]:=Join@@Function[s,Prepend[#,s]&/@sps[Complement[set,s]]]/@Cases[Subsets[set],{i,_}];
nrmmats[n_]:=Join@@Table[Table[Table[Position[stn,{i,j}][[1,1]],{i,d},{j,n/d}],{stn,Join@@Permutations/@sps[Tuples[{Range[d],Range[n/d]}]]}],{d,Divisors[n]}];
apermatQ[m_]:=UnsameQ@@Join@@Table[RotateLeft[m,{i,j}],{i,Length[m]},{j,Length[First[m]]}];
neckmatQ[m_]:=m==First[Union@@Table[RotateLeft[m,{i,j}],{i,Length[m]},{j,Length[First[m]]}]];
Table[Length[Select[nrmmats[n],neckmatQ[#]&&apermatQ[#]&]],{n,6}]
A329317
Length of the Lyndon factorization of the reversed first n terms of A000002.
Original entry on oeis.org
1, 2, 3, 2, 2, 3, 3, 4, 5, 4, 5, 6, 5, 3, 4, 4, 2, 3, 4, 3, 4, 3, 3, 4, 4, 5, 6, 5, 4, 5, 5, 2, 3, 3, 4, 5, 4, 5, 6, 5, 3, 4, 4, 5, 6, 5, 6, 5, 3, 4, 4, 2, 3, 4, 3, 4, 5, 4, 3, 4, 4, 5, 6, 5, 6, 7, 6, 4, 5, 5, 3, 4, 4, 5, 6, 5, 6, 5, 4, 5, 6, 5, 6, 7, 6, 5, 6
Offset: 1
The sequence of Lyndon factorizations of the reversed initial terms of A000002 begins:
1: (1)
2: (2)(1)
3: (2)(2)(1)
4: (122)(1)
5: (1122)(1)
6: (2)(1122)(1)
7: (12)(1122)(1)
8: (2)(12)(1122)(1)
9: (2)(2)(12)(1122)(1)
10: (122)(12)(1122)(1)
11: (2)(122)(12)(1122)(1)
12: (2)(2)(122)(12)(1122)(1)
13: (122)(122)(12)(1122)(1)
14: (112212212)(1122)(1)
15: (2)(112212212)(1122)(1)
16: (12)(112212212)(1122)(1)
17: (1121122122121122)(1)
18: (2)(1121122122121122)(1)
19: (2)(2)(1121122122121122)(1)
20: (122)(1121122122121122)(1)
For example, the reversed first 13 terms of A000002 are (1221221211221), with Lyndon factorization (122)(122)(12)(1122)(1), so a(13) = 5.
The non-reversed version is
A329315.
Cf.
A000002,
A000031,
A001037,
A027375,
A059966,
A060223,
A088568,
A102659,
A211100,
A288605,
A296372,
A296658,
A329314,
A329325.
-
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,#]]&]]]];
kolagrow[q_]:=If[Length[q]<2,Take[{1,2},Length[q]+1],Append[q,Switch[{q[[Length[Split[q]]]],q[[-2]],Last[q]},{1,1,1},0,{1,1,2},1,{1,2,1},2,{1,2,2},0,{2,1,1},2,{2,1,2},2,{2,2,1},1,{2,2,2},1]]]
kol[n_Integer]:=Nest[kolagrow,{1},n-1];
Table[Length[lynfac[Reverse[kol[n]]]],{n,100}]
A334029
Length of the co-Lyndon factorization of the k-th composition in standard order.
Original entry on oeis.org
0, 1, 1, 2, 1, 1, 2, 3, 1, 1, 2, 1, 2, 2, 3, 4, 1, 1, 1, 1, 2, 1, 2, 1, 2, 2, 3, 2, 3, 3, 4, 5, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 3, 1, 2, 2, 2, 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 2, 3, 1, 2
Offset: 0
The 441st composition in standard order is (1,2,1,1,3,1), with co-Lyndon factorization {(1),(3,1),(2,1,1)}, so a(441) = 3.
The version for binary expansion is (also)
A329312.
The version for reversed binary expansion is
A329326.
Binary Lyndon/co-Lyndon words are counted by
A001037.
Necklaces covering an initial interval are
A019536.
Lyndon/co-Lyndon compositions are counted by
A059966
Length of Lyndon factorization of binomial expansion is
A211100.
Numbers whose prime signature is a necklace are
A329138.
Length of Lyndon factorization of reversed binary expansion is
A329313.
A list of all binary co-Lyndon words is
A329318.
All of the following pertain to compositions in standard order (
A066099):
- Rotational symmetries are counted by
A138904.
- Constant compositions are
A272919.
- Co-Lyndon compositions are
A326774.
- Aperiodic compositions are
A328594.
- Reversed co-necklaces are
A328595.
- Co-Lyndon factorizations are counted by
A333765.
- Lyndon factorizations are counted by
A333940.
Cf.
A034691,
A060223,
A102659,
A211097,
A292884,
A296372,
A328596,
A329358,
A329359,
A329362,
A329400,
A329401,
A333939.
-
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
colynQ[q_]:=Length[q]==0||Array[Union[{RotateRight[q,#1],q}]=={RotateRight[q,#1],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,#1]]&]]]]
Table[Length[colynfac[stc[n]]],{n,0,100}]
Comments