Please help! I found a script that uses the following method to calculate pi:

1/pi = sqrt(8)/9801 * infinite sum 0 to infinity ((4n)!*(1103 + 26390n)/((n!)^4*396^(4n))

Here's the code:

I would appreciate it if someone could comment the code (it's not too long) so that I could learn how it works. Thank you for all the help.