A329313
Length of the Lyndon factorization of the reversed binary expansion of n.
Original entry on oeis.org
0, 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, 1, 3, 2, 5, 1, 2, 2, 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: 0
The sequence of reversed binary expansions of the nonnegative integers together with their Lyndon factorizations begins:
0: () = ()
1: (1) = (1)
2: (01) = (01)
3: (11) = (1)(1)
4: (001) = (001)
5: (101) = (1)(01)
6: (011) = (011)
7: (111) = (1)(1)(1)
8: (0001) = (0001)
9: (1001) = (1)(001)
10: (0101) = (01)(01)
11: (1101) = (1)(1)(01)
12: (0011) = (0011)
13: (1011) = (1)(011)
14: (0111) = (0111)
15: (1111) = (1)(1)(1)(1)
16: (00001) = (00001)
17: (10001) = (1)(0001)
18: (01001) = (01)(001)
19: (11001) = (1)(1)(001)
20: (00101) = (00101)
The non-reversed version is
A211100.
Numbers whose reversed binary expansion is a necklace are
A328595.
Numbers whose reversed binary expansion is a aperiodic are
A328594.
Length of the co-Lyndon factorization of the binary expansion is
A329312.
Cf.
A000031,
A027375,
A059966,
A060223,
A121016,
A211097,
A275692,
A329131,
A329314,
A329317,
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,#1]]&]]]];
Table[If[n==0,0,Length[lynfac[Reverse[IntegerDigits[n,2]]]]],{n,0,30}]
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
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)
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.
Cf.
A000740,
A001037,
A001523,
A008965,
A059204,
A060223,
A211100,
A328596,
A329312,
A329318,
A329396,
A329397,
A329399,
A332578,
A332669,
A332834.
-
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}]
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.
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}]
A351200
Number of patterns of length n with all distinct runs.
Original entry on oeis.org
1, 1, 3, 11, 53, 305, 2051, 15731, 135697, 1300869, 13726431, 158137851, 1975599321, 26607158781, 384347911211, 5928465081703, 97262304328573, 1691274884085061, 31073791192091251, 601539400910369671, 12238270940611270161, 261071590963047040241
Offset: 0
The a(1) = 1 through a(3) = 11 patterns:
(1) (1,1) (1,1,1)
(1,2) (1,1,2)
(2,1) (1,2,2)
(1,2,3)
(1,3,2)
(2,1,1)
(2,1,3)
(2,2,1)
(2,3,1)
(3,1,2)
(3,2,1)
The complement for n = 3 counts the two patterns (1,2,1) and (2,1,2).
The version for run-lengths instead of runs is
A351292.
A005811 counts runs in binary expansion.
A032011 counts patterns with distinct multiplicities.
A044813 lists numbers whose binary expansion has distinct run-lengths.
A131689 counts patterns by number of distinct parts.
A297770 counts distinct runs in binary expansion.
Counting words with all distinct runs:
-
A351202 = permutations of prime factors.
Cf.
A003242,
A098504,
A098859,
A106356,
A242882,
A325545,
A328592,
A329740,
A351014,
A351204,
A351291.
-
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],UnsameQ@@Split[#]&]],{n,0,6}]
-
\\ here LahI is A111596 as row polynomials.
LahI(n,y)={sum(k=1, n, y^k*(-1)^(n-k)*(n!/k!)*binomial(n-1, k-1))}
S(n)={my(p=prod(k=1, n, 1 + y*x^k + O(x*x^n))); 1 + sum(i=1, (sqrtint(8*n+1)-1)\2, polcoef(p,i,y)*LahI(i,y))}
R(q)={[subst(serlaplace(p), y, 1) | p<-Vec(q)]}
seq(n)={my(q=S(n)); concat([1], sum(k=1, n, R(q^k-1)*sum(r=k, n, binomial(r, k)*(-1)^(r-k)) ))} \\ Andrew Howroyd, Feb 12 2022
A351292
Number of patterns of length n with all distinct run-lengths.
Original entry on oeis.org
1, 1, 1, 5, 5, 9, 57, 61, 109, 161, 1265, 1317, 2469, 3577, 5785, 43901, 47165, 86337, 127665, 204853, 284197, 2280089, 2398505, 4469373, 6543453, 10570993, 14601745, 22502549, 159506453, 171281529, 314077353, 462623821, 742191037, 1031307185, 1580543969, 2141246229
Offset: 0
The a(1) = 1 through a(5) = 9 patterns:
(1) (1,1) (1,1,1) (1,1,1,1) (1,1,1,1,1)
(1,1,2) (1,1,1,2) (1,1,1,1,2)
(1,2,2) (1,2,2,2) (1,1,1,2,2)
(2,1,1) (2,1,1,1) (1,1,2,2,2)
(2,2,1) (2,2,2,1) (1,2,2,2,2)
(2,1,1,1,1)
(2,2,1,1,1)
(2,2,2,1,1)
(2,2,2,2,1)
The a(6) = 57 patterns grouped by sum:
111111 111112 111122 112221 111223 111233 112333 122333
111211 111221 122211 111322 111332 113332 133322
112111 122111 211122 112222 112223 122233 221333
211111 221111 221112 211222 113222 133222 223331
221113 122222 211333 333122
222112 211133 222133 333221
222211 221222 222331
223111 222113 233311
311122 222122 331222
322111 222221 332221
222311 333112
233111 333211
311222
322211
331112
332111
The version for runs instead of run-lengths is
A351200.
A005811 counts runs in binary expansion.
A032011 counts patterns with distinct multiplicities.
A044813 lists numbers whose binary expansion has distinct run-lengths.
A131689 counts patterns by number of distinct parts.
A165413 counts distinct run-lengths in binary expansion, runs
A297770.
Counting words with all distinct runs:
-
A351202 = permutations of prime factors.
Cf.
A003242,
A098504,
A098859,
A106356,
A239455,
A242882,
A325545,
A328592,
A329740,
A351014,
A351293.
-
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],UnsameQ@@Length/@Split[#]&]],{n,0,6}]
-
P(n) = {Vec(-1 + prod(k=1, n, 1 + y*x^k + O(x*x^n)))}
R(u,k) = {k*[subst(serlaplace(p)/y, y, k-1) | p<-u]}
seq(n)={my(u=P(n), c=poldegree(u[#u])); concat([1], sum(k=1, c, R(u, k)*sum(r=k, c, binomial(r, k)*(-1)^(r-k)) ))} \\ Andrew Howroyd, Feb 11 2022
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}]
A084784
Binomial transform = self-convolution: first column of the triangle (A084783).
Original entry on oeis.org
1, 1, 2, 6, 25, 137, 944, 7884, 77514, 877002, 11218428, 160010244, 2516742498, 43260962754, 806650405800, 16213824084864, 349441656710217, 8037981040874313, 196539809431339642, 5090276002949080318, 139202688233361310841, 4008133046329085884137
Offset: 0
G.f.: A(x) = 1 + x + 2*x^2 + 6*x^3 + 25*x^4 + 137*x^5 + 944*x^6 + ...
where
A(x) = (1-x)^(-1/4)*(1-2*x)^(-1/8)*(1-3*x)^(-1/16)*(1-4*x)^(-1/32)*...
Also,
log(A(x)) = x + 3*x^2/2 + 13*x^3/3 + 75*x^4/4 + 541*x^5/5 + 4683*x^6/6 + ... + A000670(n)*x^n/n + ...
thus, the logarithmic derivative equals the series:
A'(x)/A(x) = 1/(1-x) + 2!*x/((1-x)*(1-2*x)) + 3!*x^2/((1-x)*(1-2*x)*(1-3*x)) + 4!*x^3/((1-x)*(1-2*x)*(1-3*x)*(1-4*x)) + ...
- S. Ramanujan, Notebooks, Tata Institute of Fundamental Research, Bombay 1957 Vol. 1, see page 223.
-
m:=50;
f:= func< n,x | Exp((&+[(&+[Factorial(j)*StirlingSecond(k,j)*x^k/k: j in [1..k]]): k in [1..n+2]])) >;
R:=PowerSeriesRing(Rationals(), m+1); // A084784
Coefficients(R!( f(m,x) )); // G. C. Greubel, Jun 08 2023
-
a:= proc(n) option remember;
1+add(a(j)*(binomial(n,j)-a(n-j)), j=1..n-1)
end:
seq(a(n), n=0..25); # Alois P. Heinz, Jun 09 2023
-
a[ n_]:= If[n<1, Boole[n==0], Module[{A= 1/x - 1/x^2}, Do [A= 2 A - Normal @ Series[ (x A^2) /. x -> x-1, {x, Infinity, k+1}], {k,2,n}]; (-1)^n Coefficient[A, x, -n-1]]]; (* Michael Somos, Jun 20 2015 *)
nn=20;CoefficientList[Series[Exp[Sum[Times[1/k,i!,StirlingS2[k,i],x^k],{k,nn},{i,k}]],{x,0,nn}],x] (* Gus Wiseman, Oct 18 2016 *)
-
{a(n) = my(A); if( n<0, 0, A=1; for(k=1, n, A = truncate(A + O(x^k)) + x * O(x^k); A += A - 1 / subst(A^-2, x, x / (1 + x)) / (1 + x);); polcoeff(A, n))}; /* Michael Somos, Feb 18 2006 */
-
/* Using o.g.f. exp( Sum_{n>=1} A000670(n)*x^n/n ): */
{a(n) = polcoef(exp(intformal(sum(m=1, n+1, m!*x^(m-1)/prod(k=1, m, 1-k*x+x*O(x^n))))), n)}
for(n=0,30,print1(a(n),", "))
-
# after Alois P. Heinz
from functools import cache
from math import comb as binomial
@cache
def a(n: int) -> int:
return 1 + sum((binomial(n, j) - a(n - j)) * a(j) for j in range(1, n))
print([a(n) for n in range(22)]) # Peter Luschny, Jun 09 2023
-
m=40
def f(n, x): return exp(sum(sum(factorial(j)*stirling_number2(k,j) *x^k/k for j in range(1,k+1)) for k in range(1,n+2)))
def A084784_list(prec):
P. = PowerSeriesRing(QQ, prec)
return P( f(m,x) ).list()
A084784_list(m) # G. C. Greubel, Jun 08 2023
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 *)
Comments