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.

Showing 1-2 of 2 results.

A347811 Number A(n,k) of k-dimensional lattice walks from {n}^k to {0}^k using steps that decrease the Euclidean distance to the origin and that change each coordinate by at most 1; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 19, 25, 1, 1, 1, 323, 211075, 241, 1, 1, 1, 38716, 1322634996717, 2062017739, 2545, 1, 1, 1, 32253681, 16042961630858858915656, 29261778984922904560001, 32191353922714, 28203, 1, 1
Offset: 0

Views

Author

Alois P. Heinz, Sep 14 2021

Keywords

Comments

Lattice points may have negative coordinates, and different walks may differ in length. All walks are self-avoiding.

Examples

			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, ...
  ...
		

Crossrefs

Columns k=0+1, 2-3 give: A000012, A346539, A347813.
Rows n=0-2 give: A000012, A346840, A347812.
Main diagonal gives A347810.

Programs

  • 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) 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 *)

A346538 Table read by antidiagonals: T(n,k) is the number of paths in the Z X Z grid joining (0,0) and (n,k) each of whose steps increases the Euclidean distance to the origin and has coordinates with absolute value at most 1.

Original entry on oeis.org

1, 1, 1, 7, 3, 7, 29, 11, 11, 29, 173, 72, 25, 72, 173, 937, 382, 108, 108, 382, 937, 5527, 2295, 803, 241, 803, 2295, 5527, 32309, 13391, 4632, 1152, 1152, 4632, 13391, 32309, 193663, 80677, 29450, 9132, 2545, 9132, 29450, 80677, 193663
Offset: 0

Views

Author

Keywords

Examples

			Array begins:
     1,     1,     7,    29,    173,    937,   5527, ...
     1,     3,    11,    72,    382,   2295,  13391, ...
     7,    11,    25,   108,    803,   4632,  29450, ...
    29,    72,   108,   241,   1152,   9132,  56043, ...
   173,   382,   803,  1152,   2545,  12829, 106207, ...
   937,  2295,  4632,  9132,  12829,  28203, 147239, ...
  5527, 13391, 29450, 56043, 106207, 147239, 322681, ...
  ...
T(6,4) = T(5,3) + T(5,4) + T(5,5) + T(6,3) = 9132 + 12829 + 28203 + 56043 =106207.
T(7,5) = T(6,4) + T(6,5) + T(6,6) + T(7,4).
T(7,6) = T(6,6) + T(7,5) + T(6,5).
T(0,5) = T(-1,4) + T(0,4) + T(1,4).
		

Crossrefs

Main diagonal gives A346539.
Column (or row) k=0 gives A347814.

Programs

  • Maple
    T:= proc(n, k) option remember; `if`([n, k]=[0$2], 1, add(add(
         `if`(i^2+j^2Alois P. Heinz, Sep 08 2021
  • Mathematica
    rodean[{m_, n_}] := Select[ Complement[ Flatten[Table[{m, n} + {s, t}, {s, -1, 1}, {t, -1, 1}], 1] // Union, {{m, n}}], #[[1]]^2 + #[[2]]^2 < m^2 + n^2 &];
    $RecursionLimit = 10^6; Clear[T]; T[{0, 0}] = 1;
    T[{m_, n_}] := T[{m, n}] = Sum[T[rodean[{m, n}][[i]]],{i,Length[rodean[{m,n}]]}] ;
    Table[T[{k, n - k}], {n, 0, 12}, {k, 0, n}] // Flatten
    (* Second program: *)
    T[n_, k_] := T[n, k] = If[{n, k} == {0, 0}, 1, Sum[Sum[If[i^2 + j^2 < n^2 + k^2, T[i, j], 0], {j, k - 1, k + 1}], {i, n - 1, n + 1}]];
    Table[Table[T[n, d - n], {n, 0, d}], {d, 0, 8}] // Flatten (* Jean-François Alcover, Nov 03 2021, after Alois P. Heinz *)

Formula

T(n,k) = T(k,n).
Showing 1-2 of 2 results.