Leibniz formula for Pi
Statement
Goal
Despite there were other people who knew the formular earlier, Gottfried Wilhelm Leibniz published it first in 1682.Because you can't paste pictures of formulars here it's maybe easier to also write the first values of the row.
∑ ((-1)^i)/(2i+1)) = 1 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 ... = Pi/4
You will get a decimal number that describes how big the interval around the absolute value of Pi is. You need to "follow" the row until the point where the difference between Pi and your calculated number is lower or equal to the interval and output the index.
Note that the first index in the row is
If Pi is not accessible in your language, use
Input
Line 1: A decimal number interval.
Output
The first point in the row where the difference is lower or equal than the input.
Constraints
0 < interval < Pi
Example
Input
1
Output
0
Game modes
Test cases
Test 1 Test
Input
1
Output
0
Validator 1 Validator
Input
2
Output
0
Test 2 Test
Input
0.2
Output
4
Validator 2 Validator
Input
0.3
Output
3
Test 3 Test
Input
0.01
Output
99
Validator 3 Validator
Input
0.04
Output
24
Test 4 Test
Input
0.00036
Output
2777
Validator 4 Validator
Input
0.00016
Output
6249
Test 5 Test
Input
0.000011
Output
90909
Validator 5 Validator
Input
0.000012
Output
83333
Solution language
Solution
Stub generator input