Explore modules

Stern–Brocot Rational Tree

Find every positive rational through integer mediants and a unique left–right path.

Free theory article

Find every positive rational through integer mediants and a unique left–right path.

Concept & interpretation

The Stern–Brocot tree is a beautiful mathematical structure that enumerates all positive rational numbers in lowest terms. It generates these fractions by continuously forming the mediant of adjacent bounds, starting with 0/1 and 1/0.

experiment

Explore different rational targets and trace their location in the Stern-Brocot Tree.

  1. Set the Target dropdown to "5/7". Note the sequence of mediants evaluated as the search goes Left, Right, Right, Left.
  2. Adjust the Depth limit. If you lower it below the number of steps required to reach the target, the search stops early, and "Found" displays "No".

Try it out here: https://riano.app/module/stern-brocot-rationals

Read the full free theory article