A059966
a(n) = (1/n) * Sum_{ d divides n } mu(n/d) * (2^d - 1).
Original entry on oeis.org
1, 1, 2, 3, 6, 9, 18, 30, 56, 99, 186, 335, 630, 1161, 2182, 4080, 7710, 14532, 27594, 52377, 99858, 190557, 364722, 698870, 1342176, 2580795, 4971008, 9586395, 18512790, 35790267, 69273666, 134215680, 260300986, 505286415, 981706806
Offset: 1
a(4)=3: the 3 elements [a,c], [a[a,b]] and d form a basis of all homogeneous elements of degree 4 in the free Lie algebra with generators a of degree 1, b of degree 2, c of degree 3 and d of degree 4.
From _Gus Wiseman_, Dec 19 2017: (Start)
The sequence of Lyndon compositions organized by sum begins:
(1),
(2),
(3),(12),
(4),(13),(112),
(5),(14),(23),(113),(122),(1112),
(6),(15),(24),(114),(132),(123),(1113),(1122),(11112),
(7),(16),(25),(115),(34),(142),(124),(1114),(133),(223),(1213),(1132),(1123),(11113),(1222),(11212),(11122),(111112). (End)
- C. Reutenauer, Free Lie algebras, Clarendon press, Oxford (1993).
- Reinhard Zumkeller, Table of n, a(n) for n = 1..1000
- Nicolas Andrews, Lucas Gagnon, Félix Gélinas, Eric Schlums, and Mike Zabrocki, When are Hopf algebras determined by integer sequences?, arXiv:2505.06941 [math.CO], 2025. See p. 17.
- S. V. Duzhin and D. V. Pasechnik, Groups acting on necklaces and sandpile groups, Journal of Mathematical Sciences, August 2014, Volume 200, Issue 6, pp 690-697. See page 85. - N. J. A. Sloane, Jun 30 2014
- Seok-Jin Kang and Myung-Hwan Kim, Free Lie Algebras, Generalized Witt Formula and the Denominator Identity, Journal of Algebra 183, 560-594 (1996).
- Michael J. Mossinghoff and Timothy S. Trudgian, A tale of two omegas, arXiv:1906.02847 [math.NT], 2019.
- G. Niklasch, Some number theoretical constants: 1000-digit values [Cached copy]
- Jakob Oesinghaus, Quasi-symmetric functions and the Chow ring of the stack of expanded pairs, arXiv:1806.10700 [math.AG], 2018.
- Robert Schneider, Andrew V. Sills, and Hunter Waldron, On the q-factorization of power series, arXiv:2501.18744 [math.CO], 2025. See p. 6.
Apart from initial terms, same as
A001037.
Cf.
A000225,
A000740,
A008683,
A008965,
A011782,
A060223,
A185700,
A228369,
A269134 A281013,
A296302,
A296373.
-
a059966 n = sum (map (\x -> a008683 (n `div` x) * a000225 x)
[d | d <- [1..n], mod n d == 0]) `div` n
-- Reinhard Zumkeller, Nov 18 2011
-
Table[1/n Apply[Plus, Map[(MoebiusMu[n/# ](2^# - 1)) &, Divisors[n]]], {n, 20}]
(* Second program: *)
Table[(1/n) DivisorSum[n, MoebiusMu[n/#] (2^# - 1) &], {n, 35}] (* Michael De Vlieger, Jul 22 2019 *)
-
from sympy import mobius, divisors
def A059966(n): return sum(mobius(n//d)*(2**d-1) for d in divisors(n,generator=True))//n # Chai Wah Wu, Feb 03 2022
Description corrected by Axel Kleinschmidt, Sep 15 2002
A102659
List of Lyndon words on {1,2} sorted first by length and then lexicographically.
Original entry on oeis.org
1, 2, 12, 112, 122, 1112, 1122, 1222, 11112, 11122, 11212, 11222, 12122, 12222, 111112, 111122, 111212, 111222, 112122, 112212, 112222, 121222, 122222, 1111112, 1111122, 1111212, 1111222, 1112112, 1112122, 1112212, 1112222, 1121122
Offset: 1
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- F. Bassino, J. Clement and C. Nicaud, The standard factorization of Lyndon words: an average point of view, Discrete Math. 290 (2005), 1-25.
- Émilie Charlier, Manon Philibert, Manon Stipulanti, Nyldon words, arXiv:1804.09735 [math.CO], 2018. See Table 1.
- A. M. Uludag, A. Zeytin and M. Durmus, Binary Quadratic Forms as Dessins, 2012. - From _N. J. A. Sloane_, Dec 31 2012
- Wikipedia, Lyndon word
- Reinhard Zumkeller, Haskell programs for some sequences concerning Lyndon words
- Index entries for sequences related to Lyndon words
A sequence listing all Lyndon compositions is
A294859.
Numbers whose binary expansion is Lyndon are
A328596.
Length of the Lyndon factorization of the binary expansion is
A211100.
-
cf. link.
-
lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
Join@@Table[FromDigits/@Select[Tuples[{1,2},n],lynQ],{n,5}] (* Gus Wiseman, Nov 14 2019 *)
-
is_A102659(n)={ vecsort(d=digits(n))!=d&&for(i=1,#d-1, n>[1,10^(#d-i)]*divrem(n,10^i)&&return); fordiv(#d,L,L<#d && d==concat(Col(vector(#d/L,i,1)~*vecextract(d,2^L-1))~)&&return); !setminus(Set(d),[1,2])} \\ The last check is the least expensive one, but not useful if we test only numbers with digits {1,2}.
for(n=1,6,p=vector(n,i,10^(n-i))~;forvec(d=vector(n,i,[1,2]),is_A102659(m=d*p)&&print1(m","))) \\ One could use is_A102660 instead of is_A102659 here. - M. F. Hasler, Mar 08 2014
A228369
Triangle read by rows in which row n lists the compositions (ordered partitions) of n in lexicographic order.
Original entry on oeis.org
1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 3, 2, 1, 1, 2, 2, 3, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, 2, 2, 1, 3, 1, 1, 4, 2, 1, 1, 1, 2, 1, 2, 2, 2, 1, 2, 3, 3, 1, 1, 3, 2, 4, 1, 5, 1, 1, 1, 1, 1, 1
Offset: 1
Illustration of initial terms:
-----------------------------------
n j Diagram Composition j
-----------------------------------
. _
1 1 |_| 1;
. _ _
2 1 | |_| 1, 1,
2 2 |_ _| 2;
. _ _ _
3 1 | | |_| 1, 1, 1,
3 2 | |_ _| 1, 2,
3 3 | |_| 2, 1,
3 4 |_ _ _| 3;
. _ _ _ _
4 1 | | | |_| 1, 1, 1, 1,
4 2 | | |_ _| 1, 1, 2,
4 3 | | |_| 1, 2, 1,
4 4 | |_ _ _| 1, 3,
4 5 | | |_| 2, 1, 1,
4 6 | |_ _| 2, 2,
4 7 | |_| 3, 1,
4 8 |_ _ _ _| 4;
.
Triangle begins:
[1];
[1,1],[2];
[1,1,1],[1,2],[2,1],[3];
[1,1,1,1],[1,1,2],[1,2,1],[1,3],[2,1,1],[2,2],[3,1],[4];
[1,1,1,1,1],[1,1,1,2],[1,1,2,1],[1,1,3],[1,2,1,1],[1,2,2],[1,3,1],[1,4],[2,1,1,1],[2,1,2],[2,2,1],[2,3],[3,1,1],[3,2],[4,1],[5];
...
-
a228369 n = a228369_list !! (n - 1)
a228369_list = concatMap a228369_row [1..]
a228369_row 0 = []
a228369_row n
| 2^k == 2 * n + 2 = [k - 1]
| otherwise = a228369_row (n `div` 2^k) ++ [k] where
k = a007814 (n + 1) + 1
-- Peter Kagey, Jun 27 2016
-
Table[Sort[Join@@Permutations/@IntegerPartitions[n],OrderedQ[PadRight[{#1,#2}]]&],{n,5}] (* Gus Wiseman, Dec 14 2017 *)
-
gen_comp(n)=
{ /* Generate compositions of n as lists of parts (order is lex): */
my(ct = 0);
my(m, z, pt);
\\ init:
my( a = vector(n, j, 1) );
m = n;
while ( 1,
ct += 1;
pt = vector(m, j, a[j]);
/* for A228369 print composition: */
for (j=1, m, print1(pt[j],", ") );
\\ /* for A228525 print reversed (order is colex): */
\\ forstep (j=m, 1, -1, print1(pt[j],", ") );
if ( m<=1, return(ct) ); \\ current is last
a[m-1] += 1;
z = a[m] - 2;
a[m] = 1;
m += z;
);
return(ct);
}
for(n=1, 12, gen_comp(n) );
\\ Joerg Arndt, Sep 02 2013
-
a = [[[]], [[1]]]
for s in range(2, 9):
a.append([])
for k in range(1, s+1):
for ss in a[s-k]:
a[-1].append([k]+ss)
print(a)
# Andrey Zabolotskiy, Jul 19 2017
A296774
Triangle read by rows in which row n lists the compositions of n ordered first by length and then reverse-lexicographically.
Original entry on oeis.org
1, 2, 1, 1, 3, 2, 1, 1, 2, 1, 1, 1, 4, 3, 1, 2, 2, 1, 3, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 5, 4, 1, 3, 2, 2, 3, 1, 4, 3, 1, 1, 2, 2, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 1, 1, 3, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 6, 5, 1, 4, 2, 3, 3
Offset: 1
Triangle of compositions begins:
(1),
(2),(11),
(3),(21),(12),(111),
(4),(31),(22),(13),(211),(121),(112),(1111),
(5),(41),(32),(23),(14),(311),(221),(212),(131),(122),(113),(2111),(1211),(1121),(1112),(11111).
Cf.
A066099,
A101211,
A108730,
A124734,
A228369,
A281013,
A294859,
A296302,
A296656,
A296772,
A296773.
A296302
Number of aperiodic compositions of n with relatively prime parts. Number of compositions of n with relatively prime parts and relatively prime run-lengths.
Original entry on oeis.org
1, 0, 2, 5, 14, 24, 62, 114, 249, 480, 1022, 1978, 4094, 8064, 16348, 32520, 65534, 130512, 262142, 523270, 1048444, 2095104, 4194302, 8384316, 16777185, 33546240, 67108356, 134201398, 268435454, 536837136, 1073741822, 2147418240, 4294965244, 8589803520
Offset: 1
The a(6) = 24 aperiodic compositions with relatively prime parts are:
(15), (51),
(114), (123), (132), (141), (213), (231), (312), (321), (411),
(1113), (1122), (1131), (1221), (1311), (2112), (2211), (3111),
(11112), (11121), (11211), (12111), (21111).
Cf.
A000005,
A000740,
A000837,
A007427,
A008683,
A008965,
A059966,
A060223,
A100953,
A228369,
A281013.
-
Table[DivisorSum[n,Function[d,MoebiusMu[n/d]*DivisorSum[d,MoebiusMu[#]*2^(d/#-1)&]]],{n,20}]
A296372
Triangle read by rows: T(n,k) is the number of normal sequences of length n whose standard factorization into Lyndon words (aperiodic necklaces) has k factors.
Original entry on oeis.org
1, 1, 2, 4, 5, 4, 18, 31, 18, 8, 108, 208, 153, 56, 16, 778, 1700, 1397, 616, 160, 32, 6756, 15980, 14668, 7197, 2196, 432, 64, 68220, 172326, 171976, 93293, 31564, 7208, 1120, 128
Offset: 1
The T(3,2) = 5 normal sequences are {2,1,2}, {1,2,1}, {2,1,3}, {2,3,1}, {3,1,2}.
Triangle begins:
1;
1, 2;
4, 5, 4;
18, 31, 18, 8;
108, 208, 153, 56, 16;
778, 1700, 1397, 616, 160, 32;
6756, 15980, 14668, 7197, 2196, 432, 64;
Cf.
A000740,
A001045,
A008965,
A019536,
A059966,
A074650,
A185700,
A228369,
A232472,
A277427,
A281013,
A296373.
-
neckQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And];
aperQ[q_]:=UnsameQ@@Table[RotateRight[q,k],{k,Length[q]}];
qit[q_]:=If[#===Length[q],{q},Prepend[qit[Drop[q,#]],Take[q,#]]]&[Max@@Select[Range[Length[q]],neckQ[Take[q,#]]&&aperQ[Take[q,#]]&]];
allnorm[n_]:=Function[s,Array[Count[s,y_/;y<=#]+1&,n]]/@Subsets[Range[n-1]+1];
Table[Length[Select[Join@@Permutations/@allnorm[n],Length[qit[#]]===k&]],{n,5},{k,n}]
-
\\ here U(n,k) is A074650(n,k).
EulerMT(u)={my(n=#u, p=x*Ser(u), vars=variables(p)); Vec(exp( sum(i=1, n, substvec(p + O(x*x^(n\i)), vars, apply(v->v^i,vars))/i ))-1)}
U(n,k)={sumdiv(n, d, moebius(n/d) * k^d)/n}
A(n)={[Vecrev(p/y) | p<-sum(k=1, n, EulerMT(vector(n, n, y*U(n,k)))*sum(j=k, n, (-1)^(k-j)*binomial(j,k)))]}
{ my(T=A(10)); for(n=1, #T, print(T[n])) } \\ Andrew Howroyd, Dec 08 2018
Example and program corrected by
Gus Wiseman, Dec 08 2018
A296373
Triangle T(n,k) = number of compositions of n whose factorization into Lyndon words (aperiodic necklaces) is of length k.
Original entry on oeis.org
1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 6, 5, 3, 1, 1, 9, 12, 6, 3, 1, 1, 18, 21, 14, 6, 3, 1, 1, 30, 45, 27, 15, 6, 3, 1, 1, 56, 84, 61, 29, 15, 6, 3, 1, 1, 99, 170, 120, 67, 30, 15, 6, 3, 1, 1, 186, 323, 254, 136, 69, 30, 15, 6, 3, 1, 1, 335, 640, 510, 295, 142, 70, 30, 15, 6, 3, 1, 1
Offset: 1
Triangle begins:
1;
1, 1;
2, 1, 1;
3, 3, 1, 1;
6, 5, 3, 1, 1;
9, 12, 6, 3, 1, 1;
18, 21, 14, 6, 3, 1, 1;
30, 45, 27, 15, 6, 3, 1, 1;
56, 84, 61, 29, 15, 6, 3, 1, 1;
99, 170, 120, 67, 30, 15, 6, 3, 1, 1;
186, 323, 254, 136, 69, 30, 15, 6, 3, 1, 1;
335, 640, 510, 295, 142, 70, 30, 15, 6, 3, 1, 1;
Cf.
A000740,
A001045,
A008965,
A019536,
A059966,
A060223,
A185700,
A228369,
A232472,
A277427,
A281013,
A296302,
A296372.
-
neckQ[q_]:=Array[OrderedQ[{RotateRight[q,#],q}]&,Length[q]-1,1,And];
aperQ[q_]:=UnsameQ@@Table[RotateRight[q,k],{k,Length[q]}];
qit[q_]:=If[#===Length[q],{q},Prepend[qit[Drop[q,#]],Take[q,#]]]&[Max@@Select[Range[Length[q]],neckQ[Take[q,#]]&&aperQ[Take[q,#]]&]];
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],Length[qit[#]]===k&]],{n,12},{k,n}]
-
EulerMT(u)={my(n=#u, p=x*Ser(u), vars=variables(p)); Vec(exp( sum(i=1, n, substvec(p + O(x*x^(n\i)), vars, apply(v->v^i,vars))/i ))-1)}
A(n)=[Vecrev(p/y) | p<-EulerMT(y*vector(n, n, sumdiv(n, d, moebius(n/d) * (2^d-1))/n))]
{ my(T=A(12)); for(n=1, #T, print(T[n])) } \\ Andrew Howroyd, Dec 01 2018
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}]
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}]
A296772
Triangle read by rows in which row n lists the compositions of n ordered first by decreasing length and then reverse-lexicographically.
Original entry on oeis.org
1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 3, 1, 2, 2, 1, 3, 4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 3, 1, 1, 2, 2, 1, 2, 1, 2, 1, 3, 1, 1, 2, 2, 1, 1, 3, 4, 1, 3, 2, 2, 3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 2
Offset: 1
Triangle of compositions begins:
(1),
(11),(2),
(111),(21),(12),(3),
(1111),(211),(121),(112),(31),(22),(13),(4),
(11111),(2111),(1211),(1121),(1112),(311),(221),(212),(131),(122),(113),(41),(32),(23),(14),(5).
Cf.
A066099,
A101211,
A108730,
A124734,
A124748,
A228369,
A281013,
A294859,
A296302,
A296656,
A296773,
A296774.
Showing 1-10 of 16 results.
Comments