This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A346540 #32 Nov 04 2021 13:22:01 %S A346540 1,1,1,3,3,3,7,5,5,7,19,24,13,24,19,51,81,25,25,81,51,141,298,173,63, %T A346540 173,298,141,393,1070,739,129,129,739,1070,393,1107,3868,3423,1210, %U A346540 321,1210,3423,3868,1107,3139,13960,15363,6273,681,681,6273,15363,13960,3139 %N A346540 Number A(n,k) of walks on square lattice from (n,k) to (0,0) using steps that decrease the Euclidean distance to the origin and increase the Euclidean distance to (n,k) and that change each coordinate by at most 1; square array A(n,k), n>=0, k>=0, read by antidiagonals. %C A346540 Lattice points may have negative coordinates, and different walks may differ in length. All walks are self-avoiding. %H A346540 Alois P. Heinz, <a href="/A346540/b346540.txt">Antidiagonals n = 0..140, flattened</a> %H A346540 Alois P. Heinz, <a href="/A346541/a346541.gif">Animation of A(2,4) = 173 walks</a> %H A346540 Wikipedia, <a href="https://en.wikipedia.org/wiki/Lattice_path#Counting_lattice_paths">Counting lattice paths</a> %H A346540 Wikipedia, <a href="https://en.wikipedia.org/wiki/Self-avoiding_walk">Self-avoiding walk</a> %F A346540 A(n,k) = A(k,n). %e A346540 Square array A(n,k) begins: %e A346540 1, 1, 3, 7, 19, 51, 141, 393, ... %e A346540 1, 3, 5, 24, 81, 298, 1070, 3868, ... %e A346540 3, 5, 13, 25, 173, 739, 3423, 15363, ... %e A346540 7, 24, 25, 63, 129, 1210, 6273, 34318, ... %e A346540 19, 81, 173, 129, 321, 681, 8371, 51727, ... %e A346540 51, 298, 739, 1210, 681, 1683, 3653, 57644, ... %e A346540 141, 1070, 3423, 6273, 8371, 3653, 8989, 19825, ... %e A346540 393, 3868, 15363, 34318, 51727, 57644, 19825, 48639, ... %e A346540 ... %p A346540 s:= proc(n) option remember; %p A346540 `if`(n=0, [[]], map(x-> seq([x[], i], i=-1..1), s(n-1))) %p A346540 end: %p A346540 b:= proc(l, v) option remember; (n-> `if`(l=[0$n], 1, add((h-> `if`( %p A346540 add(i^2, i=h)<add(i^2, i=l) and add(i^2, i=v-h)>add(i^2, i=v-l) %p A346540 , b(h, v), 0))(l+x), x=s(n))))(nops(l)) %p A346540 end: %p A346540 A:= (n, k)-> b(sort([n, k])$2): %p A346540 seq(seq(A(n, d-n), n=0..d), d=0..12); %t A346540 s[n_] := s[n] = If[n == 0, {{}}, Sequence @@ %t A346540 Table[Append[#, i], {i, -1, 1}]& /@ s[n-1]]; %t A346540 b[l_, v_] := b[l, v] = With[{n = Length[l]}, %t A346540 If[l == Table[0, {n}], 1, Sum[With[{h = l+x}, %t A346540 If[h.h<l.l && (v-h).(v-h)>(v-l).(v-l), b[h, v], 0]], {x, s[n]}]]]; %t A346540 A[n_, k_] := b[Sort[{n, k}], Sort[{n, k}]]; %t A346540 Table[Table[A[n, d-n], {n, 0, d}], {d, 0, 12}] // Flatten (* _Jean-François Alcover_, Nov 04 2021, after _Alois P. Heinz_ *) %Y A346540 Columns (or rows) k=0-1 give: A002426, A347947. %Y A346540 Main diagonal gives A001850. %Y A346540 A(2n,n) gives A346541. %Y A346540 A(n-1,n) gives A002002 for n >= 1. %K A346540 nonn,tabl,walk %O A346540 0,4 %A A346540 _Alois P. Heinz_, Sep 16 2021