A118645 Number of binary strings of length n such that there exist three consecutive digits where at least two of them are 1's.
0, 0, 1, 4, 10, 23, 51, 109, 228, 471, 964, 1960, 3967, 8003, 16107, 32362, 64941, 130200, 260866, 522415, 1045831, 2093129, 4188408, 8379967, 16764552, 33535872, 67081663, 134177863, 268377031, 536785286, 1073616333, 2147299732
Offset: 0
Examples
a(4) = 10 because we have: 0011, 0101, 0110, 0111, 1010, 1011, 1100, 1101, 1110, 1111. - _Geoffrey Critzer_, Jan 19 2014
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (3,-2,1,-2).
Programs
-
Mathematica
nn=31;r=Solve[{s==1+x s+x b,a==x s,b==x a,c==x a+x b+2x c},{s,a,b,c}]; CoefficientList[Series[c/.r,{x,0,nn}],x] (* Geoffrey Critzer, Jan 19 2014 *) LinearRecurrence[{3,-2,1,-2},{0,0,1,4},40] (* Harvey P. Dale, Dec 15 2014 *)
-
PARI
x='x+O('x^50); concat([0,0], Vec((x^3 + x^2)/(2*x^4 - x^3 + 2*x^2 - 3*x + 1))) \\ G. C. Greubel, May 02 2017
Formula
a(n) = 3*2^(n-3) + a(n-1) + a(n-3) for n >= 3. - Tanya Khovanova, Aug 22 2006
From R. J. Mathar, Oct 03 2011: (Start)
G.f.: (x^3 + x^2)/(2*x^4 - x^3 + 2*x^2 - 3*x + 1).
G.f.: x^2 * (x+1)/((2*x-1)*(x^3+x-1)).
a(n) = 2^n - A000930(n+2). (End)
Extensions
More terms from Joshua Zucker, Aug 04 2006
Edited by Franklin T. Adams-Watters, Sep 30 2011
Comments