OFFSET
0,8
COMMENTS
Lattice points may have negative coordinates, and different walks may differ in length. All walks are self-avoiding.
LINKS
Alois P. Heinz, Antidiagonals n = 0..11, flattened
Alois P. Heinz, Animation of A(2,2) = 25 walks
Wikipedia, Counting lattice paths
Wikipedia, Self-avoiding walk
EXAMPLE
Square array A(n,k) begins:
1, 1, 1, 1, 1, 1, ...
1, 1, 3, 19, 323, 38716, ...
1, 1, 25, 211075, 1322634996717, ...
1, 1, 241, 2062017739, 29261778984922904560001, ...
1, 1, 2545, 32191353922714, ...
1, 1, 28203, ...
...
MAPLE
s:= proc(n) option remember;
`if`(n=0, [[]], map(x-> seq([x[], i], i=-1..1), s(n-1)))
end:
b:= proc(l) option remember; (n-> `if`(l=[0$n], 1, add((h-> `if`(
add(i^2, i=h)<add(i^2, i=l), b(sort(h)), 0))(l+x), x=s(n))))(nops(l))
end:
A:= (n, k)-> b([n$k]):
seq(seq(A(n, d-n), n=0..d), d=0..8);
MATHEMATICA
s[n_] := s[n] = If[n == 0, {{}}, Sequence @@ Table[Append[#, i], {i, -1, 1}]& /@ s[n-1]];
b[l_List] := b[l] = With[{n = Length[l]}, If[l == Table[0, {n}], 1, Sum[With[{h = l+x}, If[h.h < l.l, b[Sort[h]], 0]], {x, s[n]}]]];
A[n_, k_] := b[Table[n, {k}]];
Table[Table[A[n, d-n], {n, 0, d}], {d, 0, 8}] // Flatten (* Jean-François Alcover, Nov 03 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
AUTHOR
Alois P. Heinz, Sep 14 2021
STATUS
approved