Finding all rationals in a given range using Stern-Brocot tree

282 Views Asked by At

I know the Stern-Brocot tree lists out all the possible fractions. But how do I enumerate the fractions that are present in $[a, b]$ where $a$ and $b$ are two fractions.

1

There are 1 best solutions below

1
On BEST ANSWER

Repeatedly interleaving mediants (as in the original Stern Brocot tree) should work. See https://arxiv.org/pdf/1301.6807.pdf