This continued fraction is well-known as the value of φ, the golden ratio, an irrational number with a value of or approximately 1.618; by the 200th term, the error is -7.851 × 10-84. The golden ratio is common in nature, art and music.

Since this was posted for my math class (I’m the daughter mentioned in the problem), I was just wondering if anyone here can solve it without using computer programming. The reason I ask is that some interesting mathematical constants start to appear as you solve using algebra. If you don’t remember high school algebra, then solving the first ten numbers by had and leaving the fractions in improper form will reveal some sequences as well. That’s what the homework was actually designed to teach us. Just a thought.

As you noticed, the numerators and denominators of the terms are Fibonacci numbers. That’s because there is an intimate relationship between the Fibonacci numbers and the Golden Ratio. In particular, the ratio of n+1st and nth Fibonacci numbers tend to the Golden Ratio as n gets large. The same thing happens for the continued fraction as your dad illustrated. See http://www.friesian.com/golden.htm for an explanation of this that should be accessible to anyone with a little algebra background.

Before I really thought about the problem very much I tried coding it up in C#, which was easy enough. It surprised me when it overflowed a 64-bit unsigned integer. The reason why it caused an overflow became obvious once I took a look at the comments here. The code is just calculating a Fibonacci number. G(n) = F(n+2)/F(n+1). A true solution would require a bigint implementation. Without resorting to that, I rewrote the code using doubles. I thought it was interesting to discover that after G(40), the error in the approximation of the golden ratio became too small to store in a double.

It’s nice to see this thread still active. Here’s a solution that runs
in log n time. It’s based on Anne’s observation that Gn = Fibn+1
/ Fibn (easily shown by a simple induction) and the fast-fib routine
from Exercise 1.19 of SICP.