OFFSET
0,3
LINKS
Wikipedia, Tromino
EXAMPLE
a(2) = 4:
.___. .___. .___. .___.
|_| | | |_| | ._| |_. |
|___| |___| |_|_| |_|_| .
MAPLE
b:= proc(n, w, l) option remember; local k, t;
if max(l[])>n then 0 elif n=0 then 1
elif min(l[])>0 then t:=min(l[]); b(n-t, w, map(h->h-t, l))
else for k while l[k]>0 do od;
`if`(w, b(n, false, s(k=1, l)), 0)+
`if`(k>1 and l[k-1]=1, b(n, w, s(k=2, k-1=2, l)), 0)+
`if`(k<nops(l) and l[k+1]=1, b(n, w, s(k=2, k+1=2, l)), 0)+
`if`(k<nops(l) and l[k+1]=0, b(n, w, s(k=1, k+1=2, l))+
b(n, w, s(k=2, k+1=1, l))+
`if`(w, b(n, false, s(k=2, k+1=2, l)), 0), 0)+
`if`(k+1<nops(l) and l[k+1]=0 and l[k+2]=0,
b(n, w, s(k=2, k+1=2, k+2=2, l)), 0)
fi
end:
a:= n-> b(n, evalb(irem(n, 3)>0), [0$n]): s:= subsop:
seq(a(n), n=0..10);
MATHEMATICA
$RecursionLimit = 1000; s = ReplacePart; b[n_, w_, l_] := b[n, w, l] = Module[{k, t}, Which[Max[l] > n, 0, n == 0, 1, Min[l] > 0, t = Min[l]; b[n-t, w, l-t], True, For[k = 1, l[[k]] > 0, k++ ]; If[w, b[n, False, s[l, k -> 1]], 0]+If[k > 1 && l[[k-1]] == 1, b[n, w, s[l, {k -> 2, k-1 -> 2}]], 0] + If[k < Length[l] && l[[k+1]] == 1, b[n, w, s[l, {k -> 2, k+1 -> 2}]], 0] + If[k < Length[l] && l[[k+1]] == 0, b[n, w, s[l, {k -> 1, k+1 -> 2}]]+b[n, w, s[l, {k -> 2, k+1 -> 1}]] + If[w, b[n, False, s[l, {k -> 2, k+1 -> 2}]], 0], 0] + If[k+1 < Length[l] && l[[k+1]] == 0 && l[[k+2]] == 0, b[n, w, s[l, {k -> 2, k+1 -> 2, k+2 -> 2}]], 0] ] ]; a[n_] := b[n, Mod[n, 3] > 0, Array[0 &, n]]; Table[Print[an = a[n]]; an, {n, 0, 16}] (* Jean-François Alcover, Dec 30 2013, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Dec 16 2013
EXTENSIONS
a(17) from Alois P. Heinz, Sep 24 2014
STATUS
approved