A326774
For any number m, let m* be the bi-infinite string obtained by repetition of the binary representation of m; this sequence lists the numbers n such that for any k < n, n* does not equal k* up to a shift.
Original entry on oeis.org
0, 1, 2, 4, 5, 8, 9, 11, 16, 17, 18, 19, 21, 23, 32, 33, 34, 35, 37, 38, 39, 43, 47, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 77, 78, 79, 85, 87, 91, 95, 128, 129, 130, 131, 132, 133, 134, 135, 137, 138, 139, 140, 141, 142, 143, 146, 147, 149, 150, 151, 154
Offset: 0
3* = ...11... equals 1* = ...1..., so 3 is not a term.
6* = ...110... equals up to a shift 5* = ...101..., so 6 is not a term.
11* = ...1011... only equals up to a shift 13* = ...1101... and 14* = ...1110..., so 11 is a term.
Necklace compositions are counted by
A008965.
Lyndon compositions are counted by
A059966.
Length of Lyndon factorization of binary expansion is
A211100.
Numbers whose reversed binary expansion is a necklace are
A328595.
Length of co-Lyndon factorization of binary expansion is
A329312.
Length of Lyndon factorization of reversed binary expansion is
A329313.
Length of co-Lyndon factorization of reversed binary expansion is
A329326.
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 (this sequence).
- Aperiodic compositions are
A328594.
- Reversed co-necklaces are
A328595.
- Co-Lyndon factorizations are counted by
A333765.
- Lyndon factorizations are counted by
A333940.
- Length of co-Lyndon factorization is
A334029.
-
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
colynQ[q_]:=Length[q]==0||Array[Union[{RotateRight[q,#],q}]=={RotateRight[q,#],q}&,Length[q]-1,1,And];
Select[Range[0,100],colynQ[stc[#]]&] (* Gus Wiseman, Apr 19 2020 *)
-
See Links section.
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[#]]&]
A082550
Number of sets of distinct positive integers whose arithmetic mean is an integer, the largest integer of the set being n.
Original entry on oeis.org
1, 1, 3, 3, 7, 11, 19, 31, 59, 103, 187, 343, 631, 1171, 2191, 4095, 7711, 14571, 27595, 52431, 99879, 190651, 364723, 699071, 1342183, 2581111, 4971067, 9586983, 18512791, 35791471, 69273667, 134217727, 260301175, 505290271, 981706831, 1908874583, 3714566311
Offset: 1
a(5) = 7: the seven sets are (1+2+3+4+5)/5 = 3, 5/1 = 5, (1+5)/2 = 3, (1+3+5)/3 = 3, (3+5)/2 = 4, (3+4+5)/3 = 4, (1+2+4+5)/4 = 3.
-
Table[Length[Select[Select[Subsets[Range[n]],Max[#]==n&], IntegerQ[ Mean[ #]]&]], {n,22}] (* Harvey P. Dale, Jul 23 2011 *)
Table[Total[Table[Length[Select[Select[Subsets[Range[n]], Length[#] == k &],IntegerQ[Total[#]/n] &]], {k, n}]], {n, 10}] (* Dimitri Papadopoulos, Jan 18 2016 *)
-
a(n) = sumdiv(n, d, (d%2)* 2^(n/d)*eulerphi(d))/n - 1; \\ Michel Marcus, Feb 10 2016
-
from sympy import totient, divisors
def A082550(n): return (sum(totient(d)<>(~n&n-1).bit_length(),generator=True))<<1)//n-1 # Chai Wah Wu, Feb 22 2023
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
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
A333632
Rotational period of the k-th composition in standard order; a(0) = 0.
Original entry on oeis.org
0, 1, 1, 1, 1, 2, 2, 1, 1, 2, 1, 3, 2, 3, 3, 1, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 1, 1, 2, 2, 3, 1, 3, 3, 4, 2, 3, 1, 4, 3, 2, 4, 5, 2, 3, 3, 4, 3, 4, 2, 5, 3, 4, 4, 5, 4, 5, 5, 1, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4
Offset: 0
The a(299) = 5 rotations:
(1,1,3,2,2)
(1,3,2,2,1)
(3,2,2,1,1)
(2,2,1,1,3)
(2,1,1,3,2)
The a(9933) = 4 rotations:
(1,2,1,3,1,2,1,3)
(1,3,1,2,1,3,1,2)
(2,1,3,1,2,1,3,1)
(3,1,2,1,3,1,2,1)
Aperiodic compositions are counted by
A000740.
Aperiodic binary words are counted by
A027375.
The orderless period of prime indices is
A052409.
Numbers whose binary expansion is periodic are
A121016.
Periodic compositions are counted by
A178472.
The version for binary expansion is
A302291.
Numbers whose prime signature is aperiodic are
A329139.
Compositions by number of distinct rotations are
A333941.
All of the following pertain to compositions in standard order (
A066099):
- Equal runs are counted by
A124767.
- Rotational symmetries are counted by
A138904.
- Constant compositions are
A272919.
- Co-Lyndon compositions are
A326774.
- Aperiodic compositions are
A328594.
- Rotational period is
A333632 (this sequence).
-
stc[n_]:=Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
Table[Length[Union[Array[RotateRight[stc[n],#]&,DigitCount[n,2,1]]]],{n,0,100}]
A345169
Numbers k such that the k-th composition in standard order is a non-alternating anti-run.
Original entry on oeis.org
37, 52, 69, 101, 104, 105, 133, 137, 150, 165, 180, 197, 200, 208, 209, 210, 261, 265, 274, 278, 300, 301, 308, 325, 328, 357, 360, 361, 389, 393, 400, 401, 406, 416, 417, 418, 421, 422, 436, 517, 521, 529, 530, 534, 549, 550, 556, 557, 564, 581, 600, 601, 613
Offset: 1
The sequence of terms together with their binary indices begins:
37: (3,2,1) 210: (1,2,3,2) 400: (1,3,5)
52: (1,2,3) 261: (6,2,1) 401: (1,3,4,1)
69: (4,2,1) 265: (5,3,1) 406: (1,3,2,1,2)
101: (1,3,2,1) 274: (4,3,2) 416: (1,2,6)
104: (1,2,4) 278: (4,2,1,2) 417: (1,2,5,1)
105: (1,2,3,1) 300: (3,2,1,3) 418: (1,2,4,2)
133: (5,2,1) 301: (3,2,1,2,1) 421: (1,2,3,2,1)
137: (4,3,1) 308: (3,1,2,3) 422: (1,2,3,1,2)
150: (3,2,1,2) 325: (2,4,2,1) 436: (1,2,1,2,3)
165: (2,3,2,1) 328: (2,3,4) 517: (7,2,1)
180: (2,1,2,3) 357: (2,1,3,2,1) 521: (6,3,1)
197: (1,4,2,1) 360: (2,1,2,4) 529: (5,4,1)
200: (1,3,4) 361: (2,1,2,3,1) 530: (5,3,2)
208: (1,2,5) 389: (1,5,2,1) 534: (5,2,1,2)
209: (1,2,4,1) 393: (1,4,3,1) 549: (4,3,2,1)
These compositions are counted by
A345195.
A003242 counts anti-run compositions.
A345164 counts alternating permutations of prime indices.
A345165 counts partitions w/o an alternating permutation, ranked by
A345171.
A345170 counts partitions w/ an alternating permutation, ranked by
A345172.
A345192 counts non-alternating compositions.
Statistics of standard compositions:
- Number of distinct parts is
A334028.
Classes of standard compositions:
- Weakly decreasing compositions (partitions) are
A114994.
- Weakly increasing compositions (multisets) are
A225620.
- Constant compositions are
A272919.
- Strictly increasing compositions (sets) are
A333255.
- Strictly decreasing compositions (strict partitions) are
A333256.
- Alternating compositions are
A345167.
- Non-Alternating compositions are
A345168.
Cf.
A001222,
A008965,
A238279,
A344614,
A344615,
A344652,
A344653,
A344654,
A345162,
A345163,
A345193,
A348609,
A348613.
-
stc[n_]:=Differences[Prepend[Join@@Position[ Reverse[IntegerDigits[n,2]],1],0]]//Reverse;
wigQ[y_]:=Or[Length[y]==0,Length[Split[y]]== Length[y]&&Length[Split[Sign[Differences[y]]]]==Length[y]-1];
sepQ[y_]:=!MatchQ[y,{_,x_,x_,_}];
Select[Range[0,1000],sepQ[stc[#]]&&!wigQ[stc[#]]&]
Comments