CalcWorldHub
Free online calculator · no signup

Stern Brocot rational path calculator

Locate a positive rational in the Stern–Brocot tree and report its left/right path from 1/1.

4,000 tools
Stern Brocot rational path calculator — Positive numerator, Positive denominator and calculation method
Stern Brocot rational path calculator: inputs and calculation method.

How to use this calculator

Locate a positive rational in the Stern–Brocot tree and report its left/right path from 1/1.

  1. Enter Positive numerator, Positive denominator. Match the units shown beside each field and review the result together with the assumptions below.
  2. Read the worked example below to check the expected input format and result.
  3. Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Calculation guide

Stern Brocot rational path explained

The Stern–Brocot tree starts at 1/1. Compare the target rational with each mediant: move right when it is larger and left when it is smaller. Every positive reduced rational appears once in this tree.

Stern–Brocot pathRL
Stern–Brocot path: RL in the worked scenario.

Inputs, symbols, and units

a — Positive numerator
Positive numerator. Enter a whole number.
b — Positive denominator
Positive denominator. Enter a whole number.

Formula and method

At each node a/b, the left child is (a)/(a+b) and the right child is (a+b)/b; compare using cross-products, not rounded decimals.

For 3/2, start at 1/1: 3/2 is larger, so move right to 2/1; it is smaller than 2/1, so move left to 3/2. The path is RL. Inputs must be positive integers; equivalent fractions reduce to the same node.

A worked scenario

Positive numerator = 3; Positive denominator = 2.

  • Stern–Brocot path: RL

The path is a sequence of left and right choices, not a decimal expansion. The root 1/1 has an empty path.

Assumptions and edge cases

Equivalent fractions are reduced; paths above 10,000 steps are rejected to keep output bounded.

Frequently asked questions

What does R mean?

Move to the right subtree; L moves left.

What path represents one?

The root has an empty path.

Do 3/2 and 6/4 differ?

No, both reduce to the same tree node.

How do I use the Stern Brocot rational path calculator?

Enter Positive numerator, Positive denominator. Match the units shown beside each field and review the result together with the assumptions below.

What is a worked example of Stern Brocot rational path?

Positive numerator = 3; Positive denominator = 2. Stern–Brocot path: RL The path is a sequence of left and right choices, not a decimal expansion. The root 1/1 has an empty path.