repetitions = 100
d = 1
r = Fraction(1, d)
for n in range(repetitions):
    r += Fraction(1, d) - Fraction(1, d + 2)
d += 4
print(Decimal(r.numerator) / Decimal(r.denominator))
Бесконечные суммы в питоне