Check out this challenge:
(The competition has already ended, so I'm just curious about the Python solution, which the organizers refused to reveal, so this is not cheating in any way.)
Modified from that page:
In Calculus, the Leibniz formula for \$\pi\$ is given by:
You will be given an integer \$n\$. Your task is to print the summation of the Leibniz formula up to the \$n\$th term of the series correct to 15 decimal places.
That is given \$n\$ calculate:
with the first 15 decimal places correct.
The first line contains the number of test cases (\$T\$) which is less than 100. Each additional line is a test case for a positive integer value less than 10^7.
Output \$T\$ lines each containing the calculated result for the corresponding line of the input.
This is code-golf.
I only managed to solve the challenge in 77 characters. (Talking only about Python here.) However, one adr2370 managed to solve the challenge in 66 characters!
Please help me find the 66-character solution! I'm very very curious because I had to work really hard to bring mine down to 77, and I'm amazed as to how someone came up with a 66-character solution.
For reference, my solution:
for j in'x'*input():print'%.15f'%sum((-1)**i/(2.*i+1)for i in range(input()))