OFFSET
0,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..3448
EXAMPLE
a(0) = 1: the empty word.
a(1) = 2: 0, 1.
a(2) = 4: 00, 01, 10, 11.
a(3) = 6: 000, 001, 011, 100, 110, 111.
a(4) = 10: 0000, 0001, 0011, 0110, 0111, 1000, 1001, 1100, 1110, 1111.
a(5) = 17: 00000, 00001, 00011, 00110, 00111, 01100, 01110, 01111, 10000, 10001, 10011, 10101, 11000, 11001, 11100, 11110, 11111.
MAPLE
b:= proc(n, t, h, c) option remember; `if`(abs(c)>2*n, 0,
`if`(n=0, 1, b(n-1, [1, 3, 1][t], 2, c-`if`(h=3, 2, 0))
+ b(n-1, 2, [1, 3, 1][h], c+`if`(t=3, 1, 0))))
end:
a:= n-> b(n, 1$2, 0):
seq(a(n), n=0..50);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 23 2018
STATUS
approved