## C (GCC) (44 chars) <!-- language: lang-c --> float p(i){return i<1E6?4./++i-p(++i):0;} That's 41 chars, but it also has to be compiled with `-O2` to get the optimiser to eliminate the tail recursion. This also relies on undefined behaviour with respect to the order in which the `++` are executed; thanks to ugoren for pointing this out. I've tested with gcc 4.4.3 under 64-bit Linux . Note that unless the optimiser also reorders the sum, it will add from the smallest number, so it avoids loss of significance. Call as `p()`.