OFFSET
0,8
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..3327 (terms n = 1..210 from R. H. Hardin)
EXAMPLE
All solutions for n=7
..0. .0. .0
..1. .0. .1
..0. .1. .0
..0. .0. .0
..0. .0. .1
..1. .1. .0
..0. .0. .0
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, 1, 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..40); # Alois P. Heinz, Apr 29 2019
MATHEMATICA
b[n_, t_, h_, c_] := b[n, t, h, c] = If[Abs[c - 2] > n, 0, If[n == 0, 1,
b[n - 1, {1, 3, 1}[[t]], 2, c - If[h == 3, 1, 0]] +
b[n - 1, 2, {1, 3, 1}[[h]], c + If[t == 3, 1, 0]]]];
a[n_] := b[n, 1, 1, 0];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Jun 27 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
R. H. Hardin, May 04 2017
STATUS
approved