A292884
Number of ways to shuffle together a multiset of compositions to form a composition of n.
Original entry on oeis.org
1, 3, 8, 25, 76, 248, 806, 2714, 9205, 31846, 111185, 393224
Offset: 1
The a(3)=8 shuffles are:
(111)<=((111)), (111)<=((1)(11)), (111)<=((1)(1)(1)),
(12)<=((12)), (12)<=((1)(2)),
(21)<=((21)), (21)<=((1)(2)),
(3)<=((3)).
-
nn=10;
comps[0]:={{}};comps[n_]:=Join@@Table[Prepend[#,i]&/@comps[n-i],{i,n}];
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[Total[Length/@dealings/@comps[n]],{n,nn}]
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}]
A333764
Numbers k such that the k-th composition in standard order is a co-necklace.
Original entry on oeis.org
1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 21, 23, 31, 32, 33, 34, 35, 36, 37, 38, 39, 42, 43, 45, 47, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 77, 78, 79, 85, 87, 91, 95, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140
Offset: 1
The sequence together with the corresponding co-necklaces begins:
1: (1) 32: (6) 69: (4,2,1)
2: (2) 33: (5,1) 70: (4,1,2)
3: (1,1) 34: (4,2) 71: (4,1,1,1)
4: (3) 35: (4,1,1) 73: (3,3,1)
5: (2,1) 36: (3,3) 74: (3,2,2)
7: (1,1,1) 37: (3,2,1) 75: (3,2,1,1)
8: (4) 38: (3,1,2) 77: (3,1,2,1)
9: (3,1) 39: (3,1,1,1) 78: (3,1,1,2)
10: (2,2) 42: (2,2,2) 79: (3,1,1,1,1)
11: (2,1,1) 43: (2,2,1,1) 85: (2,2,2,1)
15: (1,1,1,1) 45: (2,1,2,1) 87: (2,2,1,1,1)
16: (5) 47: (2,1,1,1,1) 91: (2,1,2,1,1)
17: (4,1) 63: (1,1,1,1,1,1) 95: (2,1,1,1,1,1)
18: (3,2) 64: (7) 127: (1,1,1,1,1,1,1)
19: (3,1,1) 65: (6,1) 128: (8)
21: (2,2,1) 66: (5,2) 129: (7,1)
23: (2,1,1,1) 67: (5,1,1) 130: (6,2)
31: (1,1,1,1,1) 68: (4,3) 131: (6,1,1)
Necklaces covering an initial interval are
A019536.
Numbers whose prime signature is a necklace are
A329138.
Length of co-Lyndon factorization of binary expansion is
A329312.
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.
- Length of Lyndon factorization is
A329312.
Cf.
A000740,
A001037,
A027375,
A059966,
A211100,
A302291,
A328596,
A329142,
A333765,
A333939,
A333941.
-
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
coneckQ[q_]:=Array[OrderedQ[{RotateRight[q,#],q}]&,Length[q]-1,1,And];
Select[Range[100],coneckQ[stc[#]]&]
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
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)
Numbers whose binary expansion is co-Lyndon are
A275692.
Length of the co-Lyndon factorization of the binary expansion is
A329312.
Cf.
A000031,
A001037,
A059966,
A060223,
A211097,
A296372,
A296658,
A328596,
A329131,
A329314,
A329318,
A329324,
A329325.
-
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}]
A342528
Number of compositions with alternating parts weakly decreasing (or weakly increasing).
Original entry on oeis.org
1, 1, 2, 4, 7, 12, 20, 32, 51, 79, 121, 182, 272, 399, 582, 839, 1200, 1700, 2394, 3342, 4640, 6397, 8771, 11955, 16217, 21878, 29386, 39285, 52301, 69334, 91570, 120465, 157929, 206313, 268644, 348674, 451185, 582074, 748830, 960676, 1229208, 1568716, 1997064
Offset: 0
The a(1) = 1 through a(6) = 20 compositions:
(1) (2) (3) (4) (5) (6)
(11) (12) (13) (14) (15)
(21) (22) (23) (24)
(111) (31) (32) (33)
(121) (41) (42)
(211) (131) (51)
(1111) (212) (141)
(221) (222)
(311) (231)
(1211) (312)
(2111) (321)
(11111) (411)
(1212)
(1311)
(2121)
(2211)
(3111)
(12111)
(21111)
(111111)
The version with alternating parts unequal is
A224958 (unordered:
A000726).
The version with alternating parts equal is
A342527.
A000041 counts weakly increasing (or weakly decreasing) compositions.
A002843 counts compositions with all adjacent parts x <= 2y.
A003242 counts anti-run compositions.
Cf.
A001522,
A008965,
A048004,
A059966,
A062968,
A064410,
A064428,
A065608,
A167606,
A325557,
A342519.
-
b:= proc(n, i, j) option remember; `if`(n=0, 1, `if`(i<1, 0,
b(n, i-1, j)+b(n-i, min(n-i, j), min(n-i, i))))
end:
a:= n-> b(n$3):
seq(a(n), n=0..42); # Alois P. Heinz, Jan 16 2025
-
Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],GreaterEqual@@Plus@@@Reverse/@Partition[#,2,1]&]],{n,0,15}]
-
seq(n)={my(p=1/prod(k=1, n, 1-y*x^k + O(x*x^n))); Vec(1+sum(k=1, n, polcoef(p,k,y)*(polcoef(p,k-1,y) + polcoef(p,k,y))))} \\ Andrew Howroyd, Mar 24 2021
A351018
Number of integer compositions of n with all distinct even-indexed parts and all distinct odd-indexed parts.
Original entry on oeis.org
1, 1, 2, 3, 6, 9, 18, 27, 46, 77, 122, 191, 326, 497, 786, 1207, 1942, 2905, 4498, 6703, 10574, 15597, 23754, 35043, 52422, 78369, 115522, 169499, 248150, 360521, 532466, 768275, 1116126, 1606669, 2314426, 3301879, 4777078, 6772657, 9677138, 13688079, 19406214
Offset: 0
The a(1) = 1 through a(6) = 18 compositions:
(1) (2) (3) (4) (5) (6)
(1,1) (1,2) (1,3) (1,4) (1,5)
(2,1) (2,2) (2,3) (2,4)
(3,1) (3,2) (3,3)
(1,1,2) (4,1) (4,2)
(2,1,1) (1,1,3) (5,1)
(1,2,2) (1,1,4)
(2,2,1) (1,2,3)
(3,1,1) (1,3,2)
(2,1,3)
(2,3,1)
(3,1,2)
(3,2,1)
(4,1,1)
(1,1,2,2)
(1,2,2,1)
(2,1,1,2)
(2,2,1,1)
The version for run-lengths instead of runs is
A032020.
A005811 counts runs in binary expansion.
A011782 counts integer compositions.
A044813 lists numbers whose binary expansion has distinct run-lengths.
A116608 counts compositions by number of distinct parts.
A242882 counts compositions with distinct multiplicities.
A297770 counts distinct runs in binary expansion.
A325545 counts compositions with distinct differences.
A329738 counts compositions with equal run-lengths.
A329744 counts compositions by runs-resistance.
A351014 counts distinct runs in standard compositions.
Counting words with all distinct runs:
-
A351202 = permutations of prime factors.
Cf.
A003242,
A025047,
A098504,
A098859,
A106356,
A212322,
A328592,
A329740,
A334028,
A349054,
A350952,
A351205.
-
Table[Length[Select[Tuples[{0,1},n],#=={}||First[#]==1&&UnsameQ@@Split[#]&]],{n,0,10}]
-
P(n)=prod(k=1, n, 1 + y*x^k + O(x*x^n));
seq(n)=my(p=P(n)); Vec(sum(k=0, n, polcoef(p,k\2,y)*(k\2)!*polcoef(p,(k+1)\2,y)*((k+1)\2)!)) \\ Andrew Howroyd, Feb 11 2022
A329131
Numbers whose prime signature is a Lyndon word.
Original entry on oeis.org
2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 18, 19, 23, 25, 27, 29, 31, 32, 37, 41, 43, 47, 49, 50, 53, 54, 59, 61, 64, 67, 71, 73, 75, 79, 81, 83, 89, 97, 98, 101, 103, 107, 108, 109, 113, 121, 125, 127, 128, 131, 137, 139, 147, 149, 150, 151, 157, 162, 163, 167
Offset: 1
The prime signature of 30870 is (1,2,1,3), which is a Lyndon word, so 30870 is in the sequence.
The sequence of terms together with their prime indices begins:
2: {1}
3: {2}
4: {1,1}
5: {3}
7: {4}
8: {1,1,1}
9: {2,2}
11: {5}
13: {6}
16: {1,1,1,1}
17: {7}
18: {1,2,2}
19: {8}
23: {9}
25: {3,3}
27: {2,2,2}
29: {10}
31: {11}
32: {1,1,1,1,1}
Numbers whose reversed binary expansion is Lyndon are
A328596.
Numbers whose prime signature is a necklace are
A329138.
Numbers whose prime signature is aperiodic are
A329139.
Cf.
A000031,
A000740,
A000961,
A001037,
A025487,
A027375,
A097318,
A112798,
A118914,
A304678,
A318731,
A329140,
A329142.
-
lynQ[q_]:=Array[Union[{q,RotateRight[q,#]}]=={q,RotateRight[q,#]}&,Length[q]-1,1,And];
Select[Range[2,100],lynQ[Last/@FactorInteger[#]]&]
A185700
The number of periods in a reshuffling operation for compositions of n.
Original entry on oeis.org
1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 2, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 3, 5, 5, 3, 1, 0, 1, 3, 7, 8, 7, 3, 1, 0, 1, 4, 9, 14, 14, 9, 4, 1, 0, 1, 4, 12, 20, 25, 20, 12, 4, 1, 0, 1, 5, 15, 30, 42, 42, 30, 15, 5, 1, 0, 1, 5, 18, 40, 66, 75, 66, 40, 18, 5, 1, 0, 1, 6, 22, 55, 99, 132, 132, 99, 55, 22, 6, 1, 0, 1, 6, 26, 70, 143, 212, 245, 212, 143, 70, 26, 6, 1
Offset: 1
For k=5: T(4)=10 < n < T(5)=15 and all periods are of length 5:
a(11)=1 period: [(4+3+2+1+1), (4+3+2+2), (4+3+3+1), (4+4+2+1), (5+3+2+1)];
a(12)=2 periods: [(4+3+2+2+1), (4+3+3+2), (4+4+3+1), (5+4+2+1), (5+3+2+1+1)]; and [(4+4+2+2), (5+3+3+1), (4+4+2+1+1), (5+3+2+2), (4+3+3+1+1)];
a(13)=2 periods: [(4+4+2+2+1), (5+3+3+2), (4+4+3+1+1), (5+4+2+2), (5+3+3+1+1)]; and [(5+4+3+1), (5+4+2+1+1), (5+3+2+2+1), (4+3+3+2+1), (4+4+3+2)];
a(14)=1 period: [(5+4+3+2), (5+4+3+1+1), (5+4+2+2+1), (5+3+3+2+1), (4+4+3+2+1)].
For k=16; j=8; n=T(k-1)+j=128; 1<q|(16,8) --> {2,4,8} a(128) = c(128) - a(T(7)+4) - a(T(3)+2) - a(T(1)+1) = 810 - 8 - 1 - 1 = 800.
(binomial(16,8)-8*a(T(7)+4)-4*a(T(3)+2)-2*a(T(1)+1))/16 = (12870-64-4-2)/16 = 800 = a(128).
Triangular view, with a(n) distributed in rows k=1,2,3.. according to T(k-1)< n <= T(k):
1; k=1, n=1
1, 0; k=2, n=2..3
1, 1, 0; k=3, n=4..6
1, 1, 1, 0; k=4, n=7..10
1, 2, 2, 1, 0; k=5, n=11..15
1, 2, 3, 2, 1, 0; k=6, n=16..21
1, 3, 5, 5, 3, 1, 0;
1, 3, 7, 8, 7, 3, 1, 0;
1, 4, 9, 14, 14, 9, 4, 1, 0;
1, 4, 12, 20, 25, 20, 12, 4, 1, 0;
1, 5, 15, 30, 42, 42, 30, 15, 5, 1, 0;
1, 5, 18, 40, 66, 75, 66, 40, 18, 5, 1, 0;
1, 6, 22, 55, 99, 132, 132, 99, 55, 22, 6, 1, 0;
1, 6, 26, 70, 143, 212, 245, 212, 143, 70, 26, 6, 1, 0;
- R. Baumann, Computer-Knobelei, LOGIN (1987), 483-486 (in German).
Cf.
A000740,
A001037,
A008965,
A051168,
A059966,
A060223,
A245558,
A294859,
A296302,
A296373,
A092964,
A245559,
A245558.
-
A000217 := proc(n) n*(n+1)/2 ; end proc:
A185700 := proc(n) local k,j,a,q; k := ceil( (-1+sqrt(1+8*n))/2 ) ; j := n-A000217(k-1) ; if n = 1 then return 1; elif j = k then return 0 ; end if; a := binomial(k,j) ; if not isprime(k) then for q in numtheory[divisors]( igcd(k,j)) minus {1} do a := a- procname(j/q+A000217(k/q-1))*k/q ; end do: end if; a/k ; end proc:
seq(A185700(n),n=1..80) ; # R. J. Mathar, Jun 11 2011
-
LyndonQ[q_]:=Array[OrderedQ[{q,RotateRight[q,#]}]&,Length[q]-1,1,And]&&Array[RotateRight[q,#]&,Length[q],1,UnsameQ];
Table[Length@Select[Join@@Permutations/@Select[IntegerPartitions[n],Length[#]===k&],LyndonQ],{n,10},{k,n}] (* Gus Wiseman, Dec 19 2017 *)
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
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
Numbers whose binary expansion is co-Lyndon are
A275692.
Length of the co-Lyndon factorization of the binary expansion is
A329312.
-
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}]
Comments