Stern-Brocot

Stern–Brocot tree, Farey rows, and best rational approximations.

About this tool

Farey rows list reduced fractions between 0 and 1, while the Stern–Brocot tree contains every positive reduced rational exactly once. The mediant of neighbours a/b and c/d is (a+c)/(b+d).

Enter a decimal or an exact integer fraction such as 3/7. Exact fractions use BigInt cross-products to determine their path, avoiding floating-point equality. For a finite decimal and denominator limit D, the tool finds the closest p/q with q≤D. Negative targets use the reflected positive path. The displayed candidate table is the Farey interval from 0 to 1.