OFFSET
0,4
FORMULA
a(n) = (1 - 8*(n-4)*a(n-5) + 4*(3*n-10)*a(n-4) + 2*(8-3*n)*a(n-3) + (5*n-12)*a(n-2) + (7-4*n)*a(n-1))/(1-n) for n>=5.
For n >= 2, a(n) = 2*a(n-1) - A163493(n) + A163493(n-1) + A163493(n-2) + A370048(n-2). - Max Alekseyev, May 01 2024
G.f.: ((1-3*x+2*x^2)^(-1) - (1-2*x+x^2-4*x^3+4*x^4)^(-1/2)) * x / 2. - Max Alekseyev, Apr 30 2024
EXAMPLE
a(4) = 6: 0101, 0110, 0111, 1010, 1011, 1101.
a(5) = 13: 0010, 0100, 0101, 0101, 0110, 0111, 0111, 1010, 1011, 1011, 1101, 1101, 1110.
MAPLE
b:= proc(n, l, t) option remember; `if`(n+t<1, 0, `if`(n=0, 1,
add(b(n-1, i, t-`if`(l=0, (-1)^i, 0)), i=0..1)))
end:
a:= n-> b(n, 2, 0):
seq(a(n), n=0..34); # Alois P. Heinz, Mar 27 2024
MATHEMATICA
tup[n_] := Tuples[{0, 1}, n];
cou[lst_List] := Count[lst, {0, 1}] > Count[lst, {0, 0}];
par[lst_List] := Partition[lst, 2, 1];
a[n_] := Map[cou, Map[par, tup[n]]] // Boole // Total;
Monitor[Table[a[n], {n, 0, 18}], {n, Table[a[m], {m, 0, n - 1}]}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert P. P. McKone, Mar 27 2024
STATUS
approved