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.

A328345 Number of n-step walks on cubic lattice starting at (0,0,0), ending at (floor(n/3), floor((n+1)/3), floor((n+2)/3)) and using steps (0,0,1), (0,1,0), (1,0,0), (-1,1,1), (1,-1,1), and (1,1,-1).

Original entry on oeis.org

1, 1, 4, 21, 88, 440, 2385, 11781, 62832, 352128, 1842240, 10132320, 57775905, 311810785, 1746140396, 10060071021, 55367204256, 313747490784, 1820016119376, 10152658848528, 58015193420160, 338183208699840, 1905152077559808, 10954624445968896, 64089909936535329
Offset: 0

Views

Author

Alois P. Heinz, Oct 13 2019

Keywords

Comments

These walks are not restricted to the first (nonnegative) octant.

Examples

			a(2) = 4: [(0,0,0),(1,0,0),(0,1,1)], [(0,0,0),(0,1,0),(0,1,1)], [(0,0,0),(0,0,1),(0,1,1)], [(0,0,0),(-1,1,1),(0,1,1)].
		

Crossrefs

Programs

  • Maple
    b:= proc(l) option remember; `if`(l[-1]=0, 1, (r-> add(add(
          add(`if`(i+j+k=1, (h-> `if`(add(t, t=h)<0, 0, b(h)))(
          sort(l-[i, j, k])), 0), k=r), j=r), i=r))([$-1..1]))
        end:
    a:= n-> b([floor((n+i)/3)$i=0..2]):
    seq(a(n), n=0..24);
  • Mathematica
    b[l_] := b[l] = If[Last[l] == 0, 1, Sum[If[i + j + k == 1, Function[h, If[Total[h] < 0, 0, b[h]]][Sort[l - {i, j, k}]], 0], {i, {-1, 0, 1}}, {j, {-1, 0, 1}}, {k, {-1, 0, 1}}]];
    a[n_] := b[Table[Floor[(n + i)/3], {i, 0, 2}]];
    a /@ Range[0, 24] (* Jean-François Alcover, May 12 2020, after Maple *)