Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #15 Apr 28 2018 17:55:08
%S 1,2,4,6,10,17,28,49,84,148,263,472,858,1568,2893,5372,10034,18824,
%T 35428,66898,126683,240483,457334,870956,1660850,3171112,6061596,
%U 11597587,22206775,42551339,81591256,156553245,300565760,577360360,1109601934,2133499936
%N Number of binary words of length n with exactly twice as many occurrences of subword 101 as occurrences of subword 010.
%H Alois P. Heinz, <a href="/A303430/b303430.txt">Table of n, a(n) for n = 0..3448</a>
%e a(0) = 1: the empty word.
%e a(1) = 2: 0, 1.
%e a(2) = 4: 00, 01, 10, 11.
%e a(3) = 6: 000, 001, 011, 100, 110, 111.
%e a(4) = 10: 0000, 0001, 0011, 0110, 0111, 1000, 1001, 1100, 1110, 1111.
%e a(5) = 17: 00000, 00001, 00011, 00110, 00111, 01100, 01110, 01111, 10000, 10001, 10011, 10101, 11000, 11001, 11100, 11110, 11111.
%p b:= proc(n, t, h, c) option remember; `if`(abs(c)>2*n, 0,
%p `if`(n=0, 1, b(n-1, [1, 3, 1][t], 2, c-`if`(h=3, 2, 0))
%p + b(n-1, 2, [1, 3, 1][h], c+`if`(t=3, 1, 0))))
%p end:
%p a:= n-> b(n, 1$2, 0):
%p seq(a(n), n=0..50);
%Y Cf. A005251, A164146, A260668, A284449.
%Y Column k=2 of A303696.
%K nonn
%O 0,2
%A _Alois P. Heinz_, Apr 23 2018