[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A191828
Number of n-step three-sided prudent self-avoiding walks ending at the northwest corner of their box.
6
1, 2, 4, 10, 24, 59, 143, 351, 860, 2117, 5211, 12856, 31734, 78431, 193951, 479983, 1188388, 2943786, 7294704, 18082477, 44835711, 111197870, 275839085, 684372592, 1698221877, 4214570553, 10460699937, 25966317723, 64460852039
OFFSET
0,2
LINKS
Alois P. Heinz and Vaclav Kotesovec, Table of n, a(n) for n = 0..500 (first 250 terms from Alois P. Heinz)
Mireille Bousquet-Mélou, Families of prudent self-avoiding walks, DMTCS proc. AJ, 2008, 167-180.
Mireille Bousquet-Mélou, Families of prudent self-avoiding walks, arXiv:0804.4843 [math.CO], 2008-2009.
Enrica Duchi, On some classes of prudent walks, in: FPSAC'05, Taormina, Italy, 2005.
EXAMPLE
a(4) = 24: ENNW, ENWN, ENWW, NENW, NNNN, NNNW, NNWN, NNWW, NWNN, NWNW, NWWN, NWWW, WNNN, WNNW, WNWN, WNWW, WWNN, WWNW, WWWN, WWWW, WSWN, SWNN, SWNW, SWWN.
MAPLE
b:= proc(d, i, n, x, y, w) option remember;
`if`(y+w>n, 0, `if`(n=0, `if`(y=0 and w=0, 1, 0),
`if`(d in [0, 1] or d in [2, 4] and x=0 or d=2 and i,
b(1, evalb(x=0), n-1, max(x-1, 0), y, w+1), 0) +
`if`(d in [0, 2] or d in [1, 3] and (y=0 or i),
b(2, evalb(y=0), n-1, x, max(y-1, 0), w), 0) +
`if`(d in [0, 3] or d in [2, 4] and w=0 or d=2 and i,
b(3, evalb(w=0), n-1, x+1, y, max(w-1, 0)), 0) +
`if`(d in [0, 4] or d in [1, 3] and i,
b(4, false, n-1, x, y+1, w), 0)))
end:
a:= n-> b(0, true, n, 0, 0, 0):
seq(a(n), n=0..30);
MATHEMATICA
b[d_, i_, n_, x_, y_, w_] := b[d, i, n, x, y, w] = If[y+w>n, 0, If[n == 0, If[y == 0 && w == 0, 1, 0], If[MatchQ[d, 0|1] || d != 3 && x == 0 || d == 2 && i, b[1, x == 0, n-1, Max[x-1, 0], y, w+1], 0] + If[MatchQ[d, 0|2] || d != 4 && (y == 0 || i), b[2, y == 0, n-1, x, Max[y-1, 0], w], 0]+ If[MatchQ[d, 0|3] || d != 1 && w == 0 || d == 2 && i, b[3, w == 0, n-1, x+1, y, Max[w-1, 0]], 0] + If[MatchQ[d, 0|4] || d != 2 && i, b[4, s == 0, n-1, x, y+1, w], 0]]]; a[n_] := b[0, True, n, 0, 0, 0]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Dec 22 2014, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,walk
AUTHOR
Alois P. Heinz, Jun 17 2011
STATUS
approved