cp's OEIS Frontend

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.

A347812 Number of n-dimensional lattice walks from {2}^n to {0}^n using steps that decrease the Euclidean distance to the origin and that change each coordinate by at most 1.

This page as a plain text file.
%I A347812 #15 Nov 04 2021 05:58:18
%S A347812 1,1,25,211075,1322634996717,16042961630858858915656,
%T A347812 286729345864079773218271997053157611,
%U A347812 25868451537111690721940670963124809063875212336403319,3742158706432626794575922563227094346392414743343045621639247710036163317
%N A347812 Number of n-dimensional lattice walks from {2}^n to {0}^n using steps that decrease the Euclidean distance to the origin and that change each coordinate by at most 1.
%C A347812 Lattice points may have negative coordinates, and different walks may differ in length.  All walks are self-avoiding.
%H A347812 Alois P. Heinz, <a href="/A347812/b347812.txt">Table of n, a(n) for n = 0..10</a>
%H A347812 Alois P. Heinz, <a href="/A347811/a347811.gif">Animation of a(2) = 25 walks</a>
%H A347812 Wikipedia, <a href="https://en.wikipedia.org/wiki/Lattice_path#Counting_lattice_paths">Counting lattice paths</a>
%H A347812 Wikipedia, <a href="https://en.wikipedia.org/wiki/Self-avoiding_walk">Self-avoiding walk</a>
%p A347812 s:= proc(n) option remember;
%p A347812      `if`(n=0, [[]], map(x-> seq([x[], i], i=-1..1), s(n-1)))
%p A347812     end:
%p A347812 b:= proc(l) option remember; (n-> `if`(l=[0$n], 1, add((h-> `if`(
%p A347812       add(i^2, i=h)<add(i^2, i=l), b(sort(h)), 0))(l+x), x=s(n))))(nops(l))
%p A347812     end:
%p A347812 a:= n-> b([2$n]):
%p A347812 seq(a(n), n=0..7);
%t A347812 s[n_] := s[n] = If[n == 0, {{}}, Sequence @@ Table[Append[#, i], {i, -1, 1}]& /@ s[n-1]];
%t A347812 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]}]]];
%t A347812 a[n_] := b[Table[2, {n}]];
%t A347812 Table[a[n], {n, 0, 7}] (* _Jean-François Alcover_, Nov 04 2021, after _Alois P. Heinz_ *)
%Y A347812 Row n=2 of A347811.
%K A347812 nonn,walk
%O A347812 0,3
%A A347812 _Alois P. Heinz_, Sep 14 2021