Today I ran across an interesting paper. It gives a simple recurrence relationship to generate the elements of first *n* rows of a Stern-Brocot tree.

It’s surprisingly simple. To generate the first *n+1* rows, take the values

where

given

where

for odd *j* and non-negative *v _{i}*.

Put informally, *v _{i}* is the number of trailing zeroes in the binary representation of

*i*.

What’s surprising about this sequence is that it produces a list that is rational, increasing and unique.