f | import math | f | import math |
| from decimal import * | | from decimal import * |
| | | |
| | | |
| def PiGen(): | | def PiGen(): |
| getcontext().prec = 9999 | | getcontext().prec = 9999 |
n | ans = Decimal('0') | n | sum = Decimal('0') |
| k = 0 | | q = 0 |
| chislo1 = 426880*Decimal.sqrt(Decimal('10005')) | | fst_num = 426880*Decimal.sqrt(Decimal('10005')) |
| while True: | | while True: |
t | chisl = math.factorial(6*k) * (13591409 + 545140134 * k) | t | scd_num = math.factorial(6*q) * (13591409 + 545140134 * q) |
| znam = math.factorial(3*k) * (math.factorial(k) ** 3) * \ | | scd_den = math.factorial( |
| (Decimal('-262537412640768000') ** k) | | 3*q) * (math.factorial(q) ** 3) * (Decimal('-262537412640768000') ** q) |
| ans += chisl/znam | | sum += scd_num/scd_den |
| k += 1 | | q += 1 |
| res = chislo1/ans | | res = fst_num/sum |
| yield res | | yield res |
| | | |