OFFSET
1,4
COMMENTS
The Calkin-Wilf tree read breadth-first is fractions d(i)/d(i+1) where d(i) = A002487(i) is Stern's diatomic sequence, and here the n levels are read preorder.
Triangle row n comprises repetitions of the numerators in the bottom-most level (level n) of its tree since a left child has the same numerator as its parent.
This bottom-most level is Stern diatomic terms d(i) for 2^(n-1) <= i < 2^n, and the number of repetitions is the number of consecutive left children which is the ruler function A001511(i).
LINKS
Alois P. Heinz, Rows n = 1..14, flattened
Wikipedia, Calkin-Wilf tree.
EXAMPLE
Triangle begins:
k = 0 1 2 3 4 5 6 7 8 9 . . .
n=1: 1;
n=2: 1,1,2;
n=3: 1,1,1,3,2,2,3;
n=4: 1,1,1,1,4,3,3,5,2,2,2,5,3,3,4;
For row n=4, the Calkin-Wilf tree of 4 levels is as follows and row 4 is the numerators traversed in preorder
1/1
/ \
1/2 2/1
/ \ / \
1/3 3/2 2/3 3/1
/ \ / \ / \ / \
1/4 4/3 3/5 5/2 2/5 5/3 3/4 4/1
Notice each left descent has numerator unchanged and those repetitions are
row 1,1,1,1, 4, 3,3, 5, 2,2,2, 5, 3,3, 4
\-----/ ^ \-/ ^ \---/ ^ \-/ ^
term 1 4 3 5 2 5 3 4 diatomic
reps 4 1 2 1 3 1 2 1 ruler
MAPLE
b:= (n, u, d)-> [u/d, `if`(n=1, [], [b(n-1, u, u+d)[], b(n-1, u+d, d)[]])[]]:
T:= n-> map(numer, b(n, 1$2))[]:
seq(T(n), n=1..6); # Alois P. Heinz, Jan 19 2026
CROSSREFS
KEYWORD
AUTHOR
V. V. Muromtsev, Jan 19 2026
STATUS
approved
