Euler noticed that the sum of the reciprocols of the squared intergers are: \[ \frac{\pi^2}{6} = \sum_{n=1}^{\infty} \frac{1}{n^2} \\ \pi = \sqrt{6\sum_{n=1}^{\infty} \frac{1}{n^2}} \]
Let’s see if this is true.
options(digits = 22)
pi #r's default value for pi.
## [1] 3.1415926535897931
n = c(1:10)
PI = (sum(6/n^2))^0.5
PI
## [1] 3.0493616359820699
pi-PI
## [1] 0.092231017607723231
n = c(1:100)
PI = (sum(6/n^2))^0.5
PI
## [1] 3.1320765318091062
pi-PI
## [1] 0.009516121780686948
n = c(1:10000)
PI = (sum(6/n^2))^0.5
PI
## [1] 3.1414971639472093
pi-PI
## [1] 9.5489642583768131e-05
n = c(1:100000000)
PI = (sum(6/n^2))^0.5
PI
## [1] 3.1415926440404967
pi-PI
## [1] 9.5492964646837208e-09