TOPICS
Search

Calkin-Wilf Tree


A Calkin-Wilf tree is an infinite binary tree obtained by starting with the fraction 1/1 and giving each fraction a/b the left child a/(a+b) and right child (a+b)/b. It contains every positive rational number exactly once, as a reduced fraction (Calkin and Wilf 2000, pp. 361-362).

The Stern-Brocot tree is closely related, using successive mediants between neighboring fractions. At depth h>=0, each tree contains the same fractions. Numbering positions from 0 to 2^h-1 from left to right, a fraction at position j in the Calkin-Wilf tree occurs at the position obtained by reversing the h digits of j written in binary in the Stern-Brocot tree, retaining leading zeros (Gibbons et al. 2006).

Reading the levels of the Calkin-Wilf tree from left to right gives 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, ... Each denominator is the next numerator. The numerators, 1, 1, 2, 1, 3, 2, 3, 1, 4, 3, 5, 2, 5, 3, 4, ... (OEIS A002487), are the terms of Stern's diatomic series beginning at index 1. If this sequence is denoted by s_n, with s_0=0 and s_1=1, then the nth fraction is s_n/s_(n+1) for positive integer n. Stern's diatomic series is also known as the fusc function (Dijkstra 1982).


See also

Binary Tree, Stern-Brocot Tree, Stern's Diatomic Series

Explore with Wolfram|Alpha

References

Bogomolny, A. "Fractions on a Binary Tree II." https://www.cut-the-knot.org/blue/Fusc.shtml.Calkin, N. and Wilf, H. S. "Recounting the Rationals." Amer. Math. Monthly 107, 360-363, 2000. https://doi.org/10.1080/00029890.2000.12005205.Dijkstra, E. W. Selected Writings on Computing: A Personal Perspective. New York: Springer-Verlag, pp. 215-216 and 230-232, 1982.Gibbons, J.; Lester, D.; and Bird, R. "Functional Pearl: Enumerating the Rationals." J. Func. Prog. 16, 281-291, 2006. https://doi.org/10.1017/S0956796806005880. Schneider, K. "The Tree of All Fractions." 2007. https://demonstrations.wolfram.com/TheTreeOfAllFractions/.Sloane, N. J. A. Sequence A002487/M0141 in "The On-Line Encyclopedia of Integer Sequences."

Referenced on Wolfram|Alpha

Calkin-Wilf Tree

Cite this as:

Weisstein, Eric W. "Calkin-Wilf Tree." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/Calkin-WilfTree.html

Subject classifications