I have this odd goal: dedicate a Raspberry PI to calculating the value of Pi to millions of digits. Running 24/7, I have 496 weeks before my (statistically speaking) demise. So, researching on SO, I found this page that might be an answer to my quest. Question: can anyone point me to more information on this specific algorithm and whether or not it is valid and accurate for a gazillion digits? Or, if this dog can't hunt, point me to one that can. The algorithm must not consume large amounts of memory -- a hard drive will do that. Thoughts?
Asked
Active
Viewed 1,178 times
1
-
1Here is a good paper where several algorithms are discussed and compared : https://www.cs.ox.ac.uk/jeremy.gibbons/publications/spigot.pdf – Reblochon Masque Aug 24 '15 at 04:05
-
1Thank you, Reblochon! Such quick response to a vague questions. I will read the paper and comment when time permits. – WyomingGeezer Aug 24 '15 at 04:07
-
I found another resource here: [link] (http://www.numberworld.org/misc_runs/pi-5t/details.html)- most impressive! Will research and comment. – WyomingGeezer Aug 24 '15 at 04:35
-
1[Mysticial](http://stackoverflow.com/users/922184/mysticial) is the current world record holder for the most number of digits of Pi calculated. You can read his blog about the [algorithms](http://www.numberworld.org/y-cruncher/#Algorithms). On [github](https://github.com/Mysticial/Mini-Pi) there's also a simple version of Pi calculator – phuclv Aug 24 '15 at 04:35
-
Calculating only millions of digits is not that hard and won't take much time, but it's really hard to go above trillions. The y-cruncher authors use 19 2TB HDDs for that. – phuclv Aug 24 '15 at 04:39
-
Thanks to all for the commentary. I had hoped that there were many "giants" out there willing to share. My goal is to run a Raspberry PI 24/7/365 for years on end just to see how far it can go. More comments as this evolves, promise! – WyomingGeezer Aug 24 '15 at 04:42
-
If my answer was satisfactory, please approve it; not only will the "unanswered questions" list diminish, but I will be awarded reputation points. :) - Thank you. – Reblochon Masque Aug 25 '15 at 15:36
1 Answers
2
You likely want to go for an algorithm that calculates digits one by one independently. The RABINOWITZ AND WAGON’S SPIGOT ALGORITHM (presented in the paper) outputs the nth digit of pi in linear time O(n) with memory usage O(log(n)).

Reblochon Masque
- 35,405
- 10
- 55
- 80
-
1Your references are very interesting as is, also, those by Lưu Vĩnh Phúc . This is going to take me some time. At age 65, many of my synapses have been soaked in whiskey to enhance their performance but, alas, while they may be more perceptive, they are slower! TNX, my friend. – WyomingGeezer Aug 26 '15 at 03:43