A164146
Number of binary strings of length n with equal numbers of 010 and 101 substrings.
Original entry on oeis.org
1, 2, 4, 6, 12, 20, 38, 66, 124, 224, 424, 788, 1502, 2838, 5438, 10386, 20004, 38508, 74516, 144264, 280216, 544736, 1061292, 2069596, 4042254, 7902294, 15466842, 30297422, 59404174, 116558270, 228876426, 449713994, 884199348, 1739434972, 3423770240, 6742430340
Offset: 0
a(5) = 20: 00000, 00001, 00011, 00101, 00110, 00111, 01011, 01100, 01110, 01111, 10000, 10001, 10011, 10100, 11000, 11001, 11010, 11100, 11110, 11111. - _Alois P. Heinz_, Apr 16 2015
-
CoefficientList[Series[-(4*x^4-2*x^3-2*x^2+x+Sqrt[(2*x-1)*(2*x^2-1)*(2*x^2-2*x+1)]) / ((x-1)*(2*x-1)*(2*x^2-1)),{x,0,33}],x] (* Stefano Spezia, Jul 31 2025 *)
A260697
Number of binary words w of length n with equal numbers of 010 and 101 subwords such that for every prefix of w the number of occurrences of subword 101 is larger than or equal to the number of occurrences of subword 010.
Original entry on oeis.org
1, 2, 4, 6, 11, 18, 32, 54, 95, 164, 291, 514, 923, 1656, 3000, 5442, 9942, 18216, 33564, 62040, 115167, 214404, 400497, 750070, 1408734, 2652088, 5004833, 9464616, 17935137, 34049044, 64754844, 123351410, 235335966, 449632300, 860241606, 1647932000
Offset: 0
a(3) = 6: 000, 001, 011, 100, 110, 111.
a(4) = 11: 0000, 0001, 0011, 0110, 0111, 1000, 1001, 1010, 1100, 1110, 1111.
a(5) = 18: 00000, 00001, 00011, 00110, 00111, 01100, 01110, 01111, 10000, 10001, 10011, 10100, 11000, 11001, 11010, 11100, 11110, 11111.
a(10) = 291: 0000000000, 0000000001, 0000000011, ..., 0110101010, 1010101000, 1010101001, 1010101010, 1101010100, 1110101010, ..., 1111111100, 1111111110, 1111111111.
-
b:= proc(n, t, c) option remember;
`if`(c<0, 0, `if`(n=0, `if`(c=0, 1, 0),
b(n-1, [2, 4, 6, 4, 6, 4, 6][t], c-`if`(t=5, 1, 0))+
b(n-1, [3, 5, 7, 5, 7, 5, 7][t], c+`if`(t=6, 1, 0))))
end:
a:= n-> b(n, 1, 0):
seq(a(n), n=0..40);
# second Maple program:
a:= proc(n) option remember;
`if`(n<7, [1, 2, 4, 6, 11, 18, 32][n+1],
((n+3)*(307*n^2-2357*n+196) *a(n-1)
-(19280-3372*n-5181*n^2+719*n^3) *a(n-2)
+(2*(6582+268*n^3-2857*n^2+6959*n)) *a(n-3)
+(2*(-3307*n^2+1151*n+384*n^3+9052)) *a(n-4)
-(2*(1016*n^3-12133*n^2+38927*n-28304)) *a(n-5)
+(4*(27387*n+431*n^3-38420-6108*n^2)) *a(n-6)
-(4*(n-7))*(67*n-236)*(2*n-11) *a(n-7)
)/((2*(n+4))*(24*n^2-148*n-279)))
end:
seq(a(n), n=0..40);
-
b[n_, t_, c_] := b[n, t, c] =
If[c < 0, 0, If[n == 0, If[c == 0, 1, 0],
b[n - 1, {2, 4, 6, 4, 6, 4, 6}[[t]], c - If[t == 5, 1, 0]] +
b[n - 1, {3, 5, 7, 5, 7, 5, 7}[[t]], c + If[t == 6, 1, 0]]]];
a[n_] := b[n, 1, 0];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Mar 02 2022, after Alois P. Heinz *)
A260505
Number of binary words of length n with exactly one occurrence of subword 010 and exactly two occurrences of subword 101.
Original entry on oeis.org
0, 0, 0, 0, 0, 1, 2, 7, 16, 38, 82, 175, 362, 736, 1468, 2885, 5596, 10736, 20398, 38423, 71818, 133307, 245890, 450970, 822788, 1493992, 2700800, 4862566, 8721608, 15588371, 27770338, 49320863, 87344004, 154263972, 271765362, 477622769, 837519742, 1465470968
Offset: 0
a(5) = 1: 10101.
a(6) = 2: 101011, 110101.
a(7) = 7: 0101101, 0110101, 1010110, 1010111, 1011010, 1101011, 1110101.
a(8) = 16: 00101101, 00110101, 01011011, 01011101, 01101011, 01110101, 10101100, 10101110, 10101111, 10110100, 10111010, 11010110, 11010111, 11011010, 11101011, 11110101.
a(9) = 38: 000101101, 000110101, 001011011, ..., 111011010, 111101011, 111110101.
a(10) = 82: 0000101101, 0000110101, 0001011011, ..., 1111011010, 1111101011, 1111110101.
- Alois P. Heinz, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (6,-13,10,6,-18,11,6,-10,2,3,-2,-1).
-
gf:= -x^5*(2*x^2-x+1)*(x-1)^3/((x^2-x+1)^2*(x^2+x-1)^4):
a:= n-> coeff(series(gf,x,n+1),x,n):
seq(a(n), n=0..40);
-
LinearRecurrence[{6,-13,10,6,-18,11,6,-10,2,3,-2,-1},{0,0,0,0,0,1,2,7,16,38,82,175},40] (* Harvey P. Dale, Jun 26 2025 *)
A303430
Number of binary words of length n with exactly twice as many occurrences of subword 101 as occurrences of subword 010.
Original entry on oeis.org
1, 2, 4, 6, 10, 17, 28, 49, 84, 148, 263, 472, 858, 1568, 2893, 5372, 10034, 18824, 35428, 66898, 126683, 240483, 457334, 870956, 1660850, 3171112, 6061596, 11597587, 22206775, 42551339, 81591256, 156553245, 300565760, 577360360, 1109601934, 2133499936
Offset: 0
a(0) = 1: the empty word.
a(1) = 2: 0, 1.
a(2) = 4: 00, 01, 10, 11.
a(3) = 6: 000, 001, 011, 100, 110, 111.
a(4) = 10: 0000, 0001, 0011, 0110, 0111, 1000, 1001, 1100, 1110, 1111.
a(5) = 17: 00000, 00001, 00011, 00110, 00111, 01100, 01110, 01111, 10000, 10001, 10011, 10101, 11000, 11001, 11100, 11110, 11111.
-
b:= proc(n, t, h, c) option remember; `if`(abs(c)>2*n, 0,
`if`(n=0, 1, b(n-1, [1, 3, 1][t], 2, c-`if`(h=3, 2, 0))
+ b(n-1, 2, [1, 3, 1][h], c+`if`(t=3, 1, 0))))
end:
a:= n-> b(n, 1$2, 0):
seq(a(n), n=0..50);
Showing 1-4 of 4 results.