Question: import math def computefact(m): result = 1 while m > 0: result = result * m m = m - 1 return result def partA():

import math def computefact(m): result = 1 while m > 0: result = result * m m = m - 1 return result
def partA(): return math.sqrt(8) / 9801
def partB(lm): sum = 0 for n in range(lm): sum = sum + computefact(4*n) for n in range(lm): sum = sum + math.pow(computefact(n),4) return sum
def partC(lm): sum = 0 for n in range(lm): sum = sum + ((26390*n) + 1103) / (math.pow(396,(4*n))) return sum
while True: limit = int(input(" Enter Upper Limit for Pi ")) a = partA() print(" \tThe Value of a ===> ", a,8) b = partB( limit ) print(" The value of b ===> ", b ) c = partC( limit ) print(" The value of c ===> ", c ) MODIFY THE FOLLOWING CODE IN ORDER TO SOLVE THE FOLLOWING RAMANUJAN'S FORMULA FOR PI.
Ramanujan's Formula for Pi First found by Ramanujan. It's my favourite formula for pi. I have no idea how it works. 1=98018n=0(n!)4(4n)!3964n26390n+1103 Other formulas for pi: A Ramanujan-type formula due to the Chudnovsky brothers used to break a world record for computing the most digits of pi: 1=533606403201n=0(1)nn!3(3n)!(6n)!6403203n13591409+545140134n For implementations, it may help to use 6403203=8100100025327843840
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
