A277359
Number of self-avoiding planar walks starting at (0,0), ending at (n,n), remaining in the first quadrant and using steps (0,1) and (1,0) on or below the diagonal and using steps (1,1), (-1,1), and (1,-1) on or above the diagonal.
Original entry on oeis.org
1, 2, 7, 32, 176, 1126, 8227, 67768, 622706, 6323932, 70400734, 852952952, 11176241098, 157506733030, 2375966883371, 38200984291800, 652179787654530, 11783182484950980, 224623760504277810, 4505795627243046240, 94873821120923655336, 2092249161797280567516
Offset: 0
-
a:= proc(n) option remember; `if`(n<3, [1, 2, 7][n+1],
((n^3+10*n^2-10*n+1)*a(n-1)-(2*(4*n^3+2*n^2-29*n+28))
*a(n-2)+(4*(n-2))*(2*n-3)^2*a(n-3))/(n*(n+1)))
end:
seq(a(n), n=0..25);
-
a[n_] := a[n] = If[n<3, {1, 2, 7}[[n+1]], ((n^3+10*n^2-10*n+1)*a[n-1] - (2*(4*n^3+2*n^2-29*n+28))*a[n-2] + (4*(n-2))*(2*n-3)^2*a[n-3])/(n*(n+1)) ]; Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Jan 25 2017, translated from Maple *)
A285673
Total number of nodes summed over all self-avoiding planar walks starting at (0,0), ending at (n,n), remaining in the first quadrant and using steps (0,1), (1,0), (1,1), (-1,1), and (1,-1) with the restriction that (0,1) is never used below the diagonal and (1,0) is never used above the diagonal.
Original entry on oeis.org
1, 20, 907, 69928, 8190329, 1352590668, 299134112595, 85301875065360, 30466886170947633, 13319092946564641476, 6994728861780241970523, 4344874074153003071077560, 3150737511338249699332032297, 2637670112785000275509973725820, 2524664376417193478764383143006883
Offset: 0
-
b:= proc(x, y, t) option remember;
`if`(x<0 or y<0, 0,
`if`(x=0 and y=0, [1$2], (p-> p+[0, p[1]])(
`if`(x>y, b(x-1, y, 0), 0)+
`if`(y>x, b(x, y-1, 0), 0)+
b(x-1, y-1, 0)+
`if`(t<>2, b(x+1, y-1, 1), 0)+
`if`(t<>1, b(x-1, y+1, 2), 0))))
end:
a:= n-> b(n$2, 0)[2]:
seq(a(n), n=0..20);
-
b[x_, y_, t_] := b[x, y, t] = If[x < 0 || y < 0, 0, If[x == 0 && y == 0, {1, 1}, Function[p, p + {0, p[[1]]}][If[x > y, b[x - 1, y, 0], 0] + If[y > x, b[x, y - 1, 0], 0] + b[x - 1, y - 1, 0] + If[t != 2, b[x + 1, y - 1, 1], 0] + If[t != 1, b[x - 1, y + 1, 2], 0]]]];
a[n_] := b[n, n, 0][[2]];
Table[a[n], {n, 0, 20}] (* Jean-François Alcover, Jun 19 2017, translated from Maple *)
Showing 1-2 of 2 results.
Comments