Hi, currently I am working on a distributed computing project to work out the mathematical constant 'pi'. After taking a look at many examples and formulas for pi I have choson to use a common implementation of the BBP formula. This is a digit extraction formula which is able to compute any digit in Pi without having to know the n-1 digit. However, I have a problem with the script, it is quite slow, each time it is run it returns 9 digits of Pi from the value of n. If n was 1 it would return digits 1-9 . If in my basic test program I set n to be 10,000 it takes around 85 seconds to work out nine digits starting at position 10,000 of pi.
This is a problem for, as when larger values are reached (billions) it could takes weeks of cpu time just to get nine more digits. However, I am quite sure there is room for optimisation in the current formula I use. I a currently not sure which part of the formula is causing the slowdown, as my attempt to add in some debugging code failed. I have also been told by some people that it would be faster if the program used hardware cpu optimisations (sse?), however I am unsure of this. I have a feeling that is it the calculating of the prime numbers that is taking the time but I am still unsure. Here is a link to my current code as I did not want to post it in this topic.
Thank you for any help/advice you can give .