#include <stdio.h>
#include <math.h>
#include <time.h>
int main(){
double time_spent = 0.0;
clock_t begin = clock();
int n=1;
double resultNumber= 1;
double pi = 3.1415926535;
double pi2 = pi / 2;
double a;
while(1){
a = n;
a *= 4 * a;
resultNumber *= a / (a - 1);
n++;
if (fabs(resultNumber - pi2) < pow(10,-10))
break;
if (n%1000==0) {
printf("%.10f %d\n", resultNumber*2, n);
}
}
clock_t end = clock();
time_spent += (double)(end - begin) / CLOCKS_PER_SEC;
printf("The elapsed time is %f seconds", time_spent);
return 0;
}