def fr2fc(a,b,t):
    "Return continuos fraction fc0 [a1,a2,a3,...at] from a fraction a/b"
    a=float(a);b=float(b);t0=0
    fc0=[];c=(a/b);pe=int(c);pf=c-pe
    while (t0 < t):
        fc0.append(pe);t0+=1
        c=1.0/pf;pe=int(c);pf=c-pe 
    return fc0
Return continuos fraction fc0 [a1,a2,a3,...at] from a fraction a/b
recipes/Python/578936_Continous_Fractions/recipe-578936.py