In [1]:
function a0_to_an(x, n)
    ret = Array(Int64, n)
    ret[1] = Int(trunc(x))
    for i in 2:n
        ret[i] = Int(trunc(1/(x-ret[i-1])))
    end
    return ret
end


Out[1]:
kettenbruch_koeffizienten (generic function with 1 method)

In [ ]:
function q_N(an)
    sum = 0
    for i in an
        sum +=