login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Number of length n binary words that contain an even number of 0's or exactly two 1's.
0

%I #20 Dec 18 2022 19:19:48

%S 1,1,2,7,8,26,32,85,128,292,512,1079,2048,4174,8192,16489,32768,65672,

%T 131072,262315,524288,1048786,2097152,4194557,8388608,16777516,

%U 33554432,67109215,134217728,268435862,536870912,1073742289,2147483648,4294967824,8589934592

%N Number of length n binary words that contain an even number of 0's or exactly two 1's.

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

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

%F a(n) = (2^(1+n))/4 for n even; a(n) = (2^(1+n)-2*n+2*n^2)/4 for n odd. - _Colin Barker_, Jan 23 2014

%F E.g.f.: (1 + cosh(2*x) + x^2*sinh(x) + sinh(2*x))/2. - _Stefano Spezia_, Mar 20 2022

%e a(3)=7 because we have: 001, 010, 011, 100, 101, 110, 111.

%t nn=30;CoefficientList[Series[(1-x-3*x^2+6*x^3-3*x^4-2*x^5-3*x^6+x^7)/ ((1-2*x)*(1-x^2)^3),{x,0,nn}],x]

%t LinearRecurrence[{2,3,-6,-3,6,1,-2},{1,1,2,7,8,26,32,85},40] (* _Harvey P. Dale_, Dec 18 2022 *)

%Y Cf. A161680 (words containing exactly two 1's), A011782 (words containing an even number of 0's), A000384 (words containing an even number of 0's and exactly 2 1's).

%K nonn,easy

%O 0,3

%A _Geoffrey Critzer_, Jan 21 2014

%E More terms from _Colin Barker_, Jan 23 2014