English

Calkin–Wilf tree

In number theory, the Calkin–Wilf tree is a tree in which the vertices correspond one-to-one to the positive rational numbers. The tree is rooted at the number 1, and any rational number expressed in simplest terms as the fraction a/b has as its two children the numbers a/a + b and a + b/b. Every positive rational number appears exactly once in the tree. In number theory, the Calkin–Wilf tree is a tree in which the vertices correspond one-to-one to the positive rational numbers. The tree is rooted at the number 1, and any rational number expressed in simplest terms as the fraction a/b has as its two children the numbers a/a + b and a + b/b. Every positive rational number appears exactly once in the tree. The sequence of rational numbers in a breadth-first traversal of the Calkin–Wilf tree is known as the Calkin–Wilf sequence. Its sequence of numerators (or, offset by one, denominators) is Stern's diatomic series, and can be computed by the fusc function. The Calkin–Wilf tree is named after Neil Calkin and Herbert Wilf, who considered it in their 2000 paper. The tree was introduced earlier by Jean Berstel and Aldo de Luca as Raney tree, since they drew some ideas from a paper by George N. Raney. Stern's diatomic series was formulated much earlier by Moritz Abraham Stern, a 19th-century German mathematician who also invented the closely related Stern–Brocot tree. Even earlier, a similar tree appears in Kepler's Harmonices Mundi (1619). The Calkin–Wilf tree may be defined as a directed graph in which each positive rational number a/b occurs as a vertex and has one outgoing edge to another vertex, its parent. We assume that a/b is in simplest terms; that is, the greatest common divisor of a and b is 1. If a/b < 1, the parent of a/b is a/b − a; if a/b > 1, the parent of a/b is a − b/b. Thus, in either case, the parent is a fraction with a smaller sum of numerator and denominator, so repeated reduction of this type must eventually reach the number 1. As a graph with one outgoing edge per vertex and one root reachable by all other vertices, the Calkin–Wilf tree must indeed be a tree. The children of any vertex in the Calkin–Wilf tree may be computed by inverting the formula for the parents of a vertex. Each vertex a/b has one child whose value is less than 1, a/a + b, because this is the only value less than 1 whose parent formula leads back to a/b. Similarly, each vertex a/b has one child whose value is greater than 1, a + b/b. Although it is a binary tree (each vertex has two children), the Calkin–Wilf tree is not a binary search tree: its inorder does not coincide with the sorted order of its vertices. However, it is closely related to a different binary search tree on the same set of vertices, the Stern–Brocot tree: the vertices at each level of the two trees coincide, and are related to each other by a bit-reversal permutation. The Calkin–Wilf sequence is the sequence of rational numbers generated by a breadth-first traversal of the Calkin–Wilf tree, Because the Calkin–Wilf tree contains every positive rational number exactly once, so does this sequence. The denominator of each fraction equals the numerator of the next fraction in the sequence.The Calkin–Wilf sequence can also be generated directly by the formula where qi denotes the ith number in the sequence, starting from q1 = 1, and ⌊ qi ⌋ represents the integral part.

[ "Tree rotation", "Self-balancing binary search tree", "Red–black tree", "K-ary tree" ]
Parent Topic
Child Topic
    No Parent Topic