OFFSET
0,2
COMMENTS
Rows can be extended to negative k with T(n, -k) = T(n, k). Sums of such extended rows give 4^n.
The algebraic area is Integral y dx over the walk, which equals (Sum_{steps right} y) - (Sum_{steps left} y).
FORMULA
EXAMPLE
The triangle begins:
1
4
12, 2
40, 8, 4
124, 42, 16, 6, 2
416, 160, 92, 28, 16, 4, 4
1348, 678, 362, 174, 88, 34, 22, 8, 6, 2
...
T(3, 1) = 8: RUR (right, up, right), LUR, RDL, LDL, URU, URD, DLU, DLD.
PROG
(Python)
d = [{((0, 0), 0): 1}]
for _ in range(10):
nd = {}
for key, nw in d[-1].items():
pos, ar = key
x, y = pos
for key in [
((x+1, y), ar + y),
((x-1, y), ar - y),
((x, y+1), ar),
((x, y-1), ar)
]:
if key in nd:
nd[key] += nw
else:
nd[key] = nw
d.append(nd)
t = []
for nd in d:
a = [0] * (max(ar for _, ar in nd) + 1)
for key, nw in nd.items():
_, ar = key
if ar >= 0:
a[ar] += nw
t.append(a)
print(t)
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Andrei Zabolotskii, Aug 04 2025
STATUS
approved
