Stern-Brocot

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

About this tool

Stern–Brocot tree and Farey rows: every row lists reduced fractions between 0 and 1 with denominator at most n, in order.

For a real x and max denominator D, finds the closest rational p/q with q ≤ D by walking the tree (mediant search).

Also shows the BFS tree levels and the left/right path toward x.