|
|
A360173
|
|
Irregular triangle (an infinite binary tree) read by rows. The tree has root node 0, in row n=0. Each node then has left child m - n if nonnegative and right child m + n. Where m is the value of the parent node and n is the row of the children.
|
|
5
|
|
|
0, 1, 3, 0, 6, 4, 2, 10, 9, 7, 5, 15, 3, 15, 1, 13, 11, 9, 21, 10, 8, 22, 8, 6, 20, 4, 18, 2, 16, 14, 28, 2, 18, 0, 16, 14, 30, 0, 16, 14, 12, 28, 12, 10, 26, 10, 8, 24, 6, 22, 20, 36, 11, 9, 27, 9, 7, 25, 5, 23, 21, 39, 9, 7, 25, 5, 23, 3, 21, 19, 37, 3, 21
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
A node will have a left child only if the value of that child is greater than or equal to 0. But, each node will have a right child, since adding n will always be greater than 0.
|
|
LINKS
|
|
|
EXAMPLE
|
The binary tree starts with root 0 in row n = 0. In row n = 3, the parent node m = 3 has the first left child since 3 - 3 >= 0.
The tree begins:
row
[n]
[0] 0
\
[1] 1
\
[2] ___3___
/ \
/ \
[3] 0 __6__
\ / \
[4] 4 2 10
\ \ / \
[5] 9 7 5 15
|
|
MAPLE
|
T:= proc(n) option remember; `if`(n=0, 0, map(x->
[`if`(x<n, [][], x-n), x+n][], [T(n-1)])[])
end:
|
|
PROG
|
(Python)
A = [[0]]
for i in range(0, row_n):
A.append([])
for j in range(0, len(A[i])):
x = A[i][j]
if x - i -1 >= 0:
A[i+1].append(x-i-1)
if x + i + 1 >= 0:
A[i+1].append(x+i+1)
return(A)
(PARI) row(n) = { my (r=[0]); for (h=1, n, r=concat(apply(v->if (v-h>=0, [v-h, v+h], [v+h]), r))); return (r) } \\ Rémy Sigrist, Jan 31 2023
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|