OFFSET
0,3
COMMENTS
The shapes of the tiles are:
._.
._. | |
._. | | | |
._. | |_. | |_._. | |_._._.
|_| |___| |_____| |_______| ... .
LINKS
Wikipedia, Polyomino
EXAMPLE
a(3) = 8:
._____. ._____. ._____. ._____. ._____. ._____. ._____. ._____.
|_|_|_| | |_|_| |_|_|_| |_| |_| |_|_|_| |_| |_| | |_|_| | | |_|
|_|_|_| |___|_| | |_|_| |_|___| |_| |_| | |___| | |_|_| | |___|
|_|_|_| |_|_|_| |___|_| |_|_|_| |_|___| |___|_| |_____| |_____|.
.
MAPLE
b:= proc(n, l) option remember; local k, m, r;
if n=0 or l=[] then 1
elif min(l)>0 then (t-> b(n-t, map(h->h-t, l)))(min(l))
elif l[-1]=n then b(n, subsop(-1=[][], l))
else for k while l[k]>0 do od; r:= 0;
for m from 0 while k+m<=nops(l) and l[k+m]=0 and n>m do
r:= r+b(n, [l[1..k-1][], 1$m, m+1, l[k+m+1..nops(l)][]])
od; r
fi
end:
a:= n-> b(n, [0$n]):
seq(a(n), n=0..9);
MATHEMATICA
b[n_, l_] := b[n, l] = Module[{k, m, r}, Which[n == 0 || l == {}, 1, Min[l] > 0, Function[t, b[n-t, l-t]][Min[l]], l[[-1]] == n, b[n, ReplacePart[l, -1 -> Nothing]], True, For[k = 1, l[[k]] > 0, k++]; r = 0; For[m = 0, k + m <= Length[l] && l[[k+m]] == 0 && n > m, m++, r = r + b[n, Join[l[[1 ;; k-1]], Array[1&, m], {m+1}, l[[k+m+1 ;; Length[l]]]]]]; r]];
a[n_] := b[n, Array[0&, n]];
a /@ Range[0, 9] (* Jean-François Alcover, Apr 22 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Alois P. Heinz, Dec 12 2018
STATUS
approved