OFFSET
0,3
COMMENTS
From Holger Petersen (petersen(AT)informatik.uni-stuttgart.de), May 29 2006: (Start)
Also number of binary strings of length n+2 containing the pattern 010. Proof: Clear for n = 0, 1, 2. For n > 2 each string with pattern 010 of length n-1 gives 2 strings of length n with the property by appending a symbol. In addition each string of length n-1 without 010 and ending in 01 contributes one new string. Denote by c_w(m) the number of strings of length m without 010 and ending in w.
Since there is a total of 2^m strings of length m, we have c_01(m) = c_0(m-1) = (2^{m-1} - a(m-3)) - c_1(m-1) = (2^{m-1} - a(m-3)) - (2^{m-2} - a(m-4)) = 2^{m-2} - a(m-3) + a(m-4) (the first and third equalities follow from the fact that appending a 1 will not generate the pattern). The recurrence is a(n) = 2a(n-1) + c_01(n+1) = 2a(n-1) + 2^{n-1} - a(n-2) + a(n-3).
(End)
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..1000
Mathematics Stack Exchange, Recurrence relations - binary substrings
Index entries for linear recurrences with constant coefficients, signature (4,-5,3,-2).
FORMULA
From Ralf Stephan, Aug 19 2004: (Start)
G.f.: x/((1-2*x)*(1 - 2*x + x^2 - x^3)). (End)
MAPLE
f := proc(n) option remember; if n<=1 then n else if n<=3 then 7*n-10; else 2*f(n-1)-f(n-2)+f(n-3)+2^(n-1); fi; fi; end;
# second Maple program:
a:= n-> (<<0|1|0|0>, <0|0|1|0>, <0|0|0|1>, <-2|3|-5|4>>^n)[3, 4]:
seq(a(n), n=0..30); # Alois P. Heinz, Mar 27 2017
MATHEMATICA
nn=50; a=x^2/(1-x)^2; Drop[CoefficientList[Series[a x/(1-a x)/(1-2x), {x, 0, nn}], x], 2] (* Geoffrey Critzer, Nov 26 2013 *)
LinearRecurrence[{4, -5, 3, -2}, {0, 1, 4, 11}, 32] (* Jean-François Alcover, Feb 06 2016 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jason Howald (jahowald(AT)umich.edu)
STATUS
approved