That's really cool. It seems so obvious in retrospect: propagating up the tree corresponds to following the Euclidean Algorithm. Now to figure out how this emerges from the equation.

Also Michael, you can in-line MathJax like \$$\frac{1}{2} \$$ to get \$$\frac{1}{2} \$$. You can also can also click the gear and "View Source" on any comment to steal syntax. Note that sometimes MathJax doesn't load properly, so check your browser console for errors if that still doesn't work.