OFFSET
0,8
LINKS
Alois P. Heinz, Rows n = 0..140, flattened
EXAMPLE
T(4,2) = 5: ((1,0),(1,0),(-1,1),(-1,1)); ((1,0),(-1,1),(1,0),(-1,1)); ((0,1),(0,1),(0,1),(0,-1)); ((0,1),(0,1),(0,-1),(0,1)); ((0,1),(0,-1),(0,1),(0,1)).
Triangle begins:
1;
0, 1;
1, 1, 1;
1, 2, 3, 1;
2, 7, 5, 6, 1;
7, 10, 21, 14, 10, 1;
10, 38, 48, 51, 35, 15, 1;
MAPLE
b:= proc(n, k, x, y) option remember;
`if`(n<0 or x<0 or y<0 or n<x or n<abs(k-y), 0,
`if`(n=0, 1, add (b(n-1, k, x+d[1], y+d[2]),
d=[[1, 0], [0, 1], [0, -1], [-1, 1]])))
end:
T:= (n, k)-> b(n, k, 0, 0):
seq(seq(T(n, k), k=0..n), n=0..12);
MATHEMATICA
b[n_, k_, x_, y_] := b[n, k, x, y] = If[n<0 || x<0 || y<0 || n<x || n<Abs[k-y], 0, If[n == 0, 1, Sum[b[n-1, k, x+d[[1]], y+d[[2]]], {d, {{1, 0}, {0, 1}, {0, -1}, {-1, 1}}}]]]; T[n_, k_] := b[n, k, 0, 0]; Table[Table[T[n, k], {k, 0, n}], {n, 0, 12}] // Flatten (* Jean-François Alcover, Jan 19 2015, after Alois P. Heinz *)
CROSSREFS
KEYWORD
AUTHOR
Alois P. Heinz, Nov 11 2011
STATUS
approved