If you are going to work with fractions, don't do part of the calculation with floats. You can perform all the arithmetic with respect to fractions by making ai
a Fraction:
import fractions
ai = fractions.Fraction(2)
bi = 1
n = 5
for i in range(n):
ai = 2 + bi / ai
F = ai - 1
print(F)
yields
3/2
7/5
17/12
41/29
99/70