A328270 Total number of nodes in all walks on cubic lattice starting at (0,0,0), ending at (0,n,n), remaining in the first (nonnegative) octant and using steps (0,0,1), (0,1,0), (1,0,0), (-1,1,1), (1,-1,1), and (1,1,-1).
1, 9, 130, 2401, 50346, 1141030, 27222364, 673340265, 17104148290, 443406172278, 11680186909062, 311667574680190, 8404755004516300, 228659546010880620, 6267500870514732780, 172891678107177498193, 4795723803862121368590, 133668769806498536349670
Offset: 0
Examples
a(1) = 9: nodes in [(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)].
Links
- Wikipedia, Lattice path
- Wikipedia, Self-avoiding walk
Programs
-
Maple
b:= proc(l) option remember; `if`(l[-1]=0, 1, (r-> add( add(add(`if`(i+j+k=1, (h-> `if`(h[1]<0, 0, b(h)))( sort(l-[i, j, k])), 0), k=r), j=r), i=r))([$-1..1])) end: a:= n-> (2*n+1)*b([0, n$2]): seq(a(n), n=0..23);
-
Mathematica
b[l_] := b[l] = If[Last[l] == 0, 1, Function[r, Sum[If[i + j + k == 1, Function[h, If[h[[1]] < 0, 0, b[h]]][Sort[l - {i, j, k}]], 0], {i, r}, {j, r}, {k, r}]][{-1, 0, 1}]]; a[n_] := (2n+1) b[{0, n, n}]; a /@ Range[0, 23] (* Jean-François Alcover, May 13 2020, after Maple *)