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.

A346840 Number of n-dimensional lattice walks from {1}^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 A346840 #31 Nov 04 2021 05:59:27
%S A346840 1,1,3,19,323,38716,32253681,78267222216,762698791293515,
%T A346840 37603168183752885658,9243338412512497704718998,
%U A346840 11335247475355582487279558180986,68305298969167998414438069494886302081,1920885596256995709122789811280666218400361901
%N A346840 Number of n-dimensional lattice walks from {1}^n to {0}^n using steps that decrease the Euclidean distance to the origin and that change each coordinate by at most 1.
%C A346840 Lattice points may have negative coordinates, and different walks may differ in length.  All walks are self-avoiding.
%H A346840 Wikipedia, <a href="https://en.wikipedia.org/wiki/Lattice_path#Counting_lattice_paths">Counting lattice paths</a>
%H A346840 Wikipedia, <a href="https://en.wikipedia.org/wiki/Self-avoiding_walk">Self-avoiding walk</a>
%e A346840 a(3) = 19:
%e A346840   ((1,1,1), (0,0,0)),
%e A346840   ((1,1,1), (0,0,1), (0,0,0)),
%e A346840   ((1,1,1), (0,1,0), (0,0,0)),
%e A346840   ((1,1,1), (0,1,1), (0,0,0)),
%e A346840   ((1,1,1), (1,0,0), (0,0,0)),
%e A346840   ((1,1,1), (1,0,1), (0,0,0)),
%e A346840   ((1,1,1), (1,1,0), (0,0,0)),
%e A346840   ((1,1,1), (0,1,1), (-1,0,0), (0,0,0)),
%e A346840   ((1,1,1), (0,1,1), (0,0,1), (0,0,0)),
%e A346840   ((1,1,1), (0,1,1), (0,1,0), (0,0,0)),
%e A346840   ((1,1,1), (0,1,1), (1,0,0), (0,0,0)),
%e A346840   ((1,1,1), (1,0,1), (0,-1,0), (0,0,0)),
%e A346840   ((1,1,1), (1,0,1), (0,0,1), (0,0,0)),
%e A346840   ((1,1,1), (1,0,1), (0,1,0), (0,0,0)),
%e A346840   ((1,1,1), (1,0,1), (1,0,0), (0,0,0)),
%e A346840   ((1,1,1), (1,1,0), (0,0,-1), (0,0,0)),
%e A346840   ((1,1,1), (1,1,0), (0,0,1), (0,0,0)),
%e A346840   ((1,1,1), (1,1,0), (0,1,0), (0,0,0)),
%e A346840   ((1,1,1), (1,1,0), (1,0,0), (0,0,0)).
%p A346840 s:= proc(n) option remember;
%p A346840      `if`(n=0, [[]], map(x-> seq([x[], i], i=-1..1), s(n-1)))
%p A346840     end:
%p A346840 b:= proc(l) option remember; (n-> `if`(l=[0$n], 1, add((h-> `if`(
%p A346840       add(i^2, i=h)<add(i^2, i=l), b(sort(h)), 0))(l+x), x=s(n))))(nops(l))
%p A346840     end:
%p A346840 a:= n-> b([1$n]):
%p A346840 seq(a(n), n=0..10);
%t A346840 s[n_] := s[n] = If[n == 0, {{}}, Sequence @@ Table[Append[#, i], {i, -1, 1}]& /@ s[n-1]];
%t A346840 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 A346840 a[n_] := b[Table[1, {n}]];
%t A346840 Table[Print[n, " ", a[n]]; a[n], {n, 0, 13}] (* _Jean-François Alcover_, Nov 04 2021, after _Alois P. Heinz_ *)
%Y A346840 Row n=1 of A347811.
%K A346840 nonn,walk
%O A346840 0,3
%A A346840 _Alois P. Heinz_, Sep 14 2021