Here is a shortcut method to get the initial conditions that prime those recurrences.

In some books you will see them start at a0 and h[0] rather than a1 and h[1]. Just shift all indices down by one in that case. I used the higher indices because programming languages start at 1 not 0 for an array.

]]>Look at the cf:

See the 1,1 at the beginning? That can be expressed as 1 / 1 and 1 / 1.

So

h[1] = 1 and h[2] = 1. ( the numerators )

k[1] = 1 and k[2] = 1. ( the denominators )

Now isn't that the neatest thing you ever saw! Computational mathematics!

]]>Call the representation above a1,a2,a3,a4,a5...

You start with the numerators of the a's and use this recurrence.

with the initial conditions of

The first few numerators are

The denominators are done in the same way.

with the initial conditions of

The first few denominators are;

For example the fifth convergent is 19 / 11.

]]>Do you know how to get the continued fraction representation of that first?

The convergents are:

]]>