login
Number of binary sequences of length n with an even number of ones, at least two of the ones being contiguous.
1

%I #28 Sep 08 2022 08:44:49

%S 0,1,2,4,9,21,47,101,212,440,907,1859,3791,7699,15586,31476,63445,

%T 127689,256671,515433,1034248,2073968,4156791,8327911,16679007,

%U 33395527,66851750,133801708,267762321,535781757,1071979535

%N Number of binary sequences of length n with an even number of ones, at least two of the ones being contiguous.

%H Vincenzo Librandi, <a href="/A027711/b027711.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (4,-5,2,1,-2).

%F G.f.: x^2*(1 - 2*x + x^2 + x^3)/((2*x-1)*(x^2 + x - 1)*(x^2 - x + 1)).

%F a(n) = 4*a(n-1) - 5*a(n-2) + 2*a(n-3) + a(n-4) - 2*a(n-5).

%t LinearRecurrence[{4,-5,2,1,-2},{0,1,2,4,9},40] (* _Vincenzo Librandi_, Jun 20 2012 *)

%t CoefficientList[Series[x^2*(1-2*x+x^2+x^3)/((2*x-1)*(x^2+x-1)*(x^2-x+1)), {x, 0, 50}], x] (* _G. C. Greubel_, Jun 10 2017 *)

%o (Magma) I:=[0, 1, 2, 4, 9]; [n le 5 select I[n] else 4*Self(n-1)-5*Self(n-2)+2*Self(n-3)+Self(n-4)-2*Self(n-5): n in [1..40]]; // _Vincenzo Librandi_, Jun 20 2012

%o (PARI) x='x+O('x^50); Vec(x^2*(1-2*x+x^2+x^3)/((2*x-1)*(x^2+x-1)*(x^2-x+1))) \\ _G. C. Greubel_, Jun 10 207

%K nonn,easy

%O 1,3

%A _R. K. Guy_

%E Typo in denominator of g.f. corrected by _R. J. Mathar_, Sep 03 2010