@Dennis Lomas

Yes, if you have one row, you can get either the row prior or the next row fairly easily.

Each row, \$$i\$$, has \$$2^i\$$ elements (with \$$i\$$ starting at 0). Using a new function \$$h(i,j) = g(2^i+j)\$$ where \$$g\$$ is defined by Patrick above (#3), and \$$j \in [0,2^i-1]\$$ is used to index into the row itself.

We can get see that \$$h(i,j) = h(i,2j)\cdot h(i,2j+1)\$$. This is the same tree structure mentioned by Michael Hong in #15 (see the wikipedia page on the Calkin-Wilf tree for a good visualization of this).

To get the *next* row, we know that \$$h(i,j) = \frac{a}{b}\$$ for some \$$a,b\$$. \$$h(i,2j) = \frac{a}{a+b}\$$ and \$$h(i,2j+1) = \frac{a+b}{b}\$$.