Walking the Tree.

It’s just fun playing around with Stern-Brocot trees and a bit of Haskell…! For any fraction on the Stern-Brocot tree there is just one path to it from the root. That path can written as a sequence of left or right ‘turns’ at each node depending on whether the target node is smaller or larger than the current node. This leads to the Stern Path For example in this small tree the path to, say, 4/5 is, from 1/1, LRRR. The fraction 5/2 has path RRL. To get to 5/8 we go LRLR… and so on. (If you want to Read More


A Stern View.

    We all know the Fibonacci sequence and how it is generated… 1, 1, 2, 3, 5, 8,… We just add the ‘previous’ pair to get the next number and then move along to the next pair. An interesting variation on this is to add adjacent pairs and write down their sum as before but, after appending the sum, also append the second digit of the pair just added and this gives… 1, 1, 2, 1, 3, 2, 3, 1 … Starting with 1, 1 1 + 1 -> 2 – append 2 and then copy forward 1 1 Read More


Fractions to Phi to Fibonacci!

Oh no, not another Haskell way of calculating Fibonacci numbers! Well, yes but done perhaps slightly differently. This post brings together The Golden Ratio Fibonacci Numbers Continued Fractions The Golden Ratio (Phi) “…two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities.” This ratio appears often mathematics and in nature, perhaps almost as pervasive as pi. And there is the Golden Rectangle, a 2-D extension of the Golden Ratio, often used in art because of its intrinsically appealing properties. Fibonacci Numbers 0, 1, 1, Read More


ˆ Back To Top