## Distributed Pi

Welcome to the distributed Pi project. So far 1082 users have generated over 8,864,792 binary digits of Pi, why not help us generate more?
To contribute towards this project no additional software is needed, all you need to do is click the big contribute button!

Warning: This may cause your CPU utilisation to go to 100% and browser to hang.

 Digits Generated: 0 Current Digit: (0%) Last Digit: State: Stopped

Impressed? Why not learn more (below) or share it with the world!

### News

#### Pi Day - 2011

To celebrate, the visualisation of 6 random walks using the Pi digits are available here: Random walks with Pi

### What?

The aim of this project is to generate the binary digits of Pi by utilising distributed computing... with a twist.
Unlike other distributed computing projects there is no specialised software involved, in fact all that is required is a modern web browser with Javascript enabled!

### Why?

Why not? Secondly, for my MSc dissertation I was required to generate digits of Pi, ever since I have had an unhealthy addiction to Pi.

### How?

The Bailey-Borwein-Plouffe (BBP) algorithm for Pi is capable of generating any arbitary binary digit of Pi. We utilise this by having the browser request work from a central server which responds with a digit that is missing from the database. Your browser then generates this digit and returns it to the database.

### How much work is completed?

It varies, but generally it's decreasing as unfortunately the workload increases as the position of a digit increases. The chart below shows the number of digits generated over the past few active days:

### Technical Challenges

Due to the simplicity of the BBP algorithm and the power of Javascript the project was quite simple. However, I did hit some hurdles, first and foremost the algorithm requires modular exponentiation so a function to do this had to be written (Special thanks Wikipedia for publishing a flawed algorithm!) due to Javascript lacking this functionality. Secondly, a foreseen problem is that Javascript uses a 64 bit floating point precision for all numbers, the result of this is that should any integer have any more than 253 digits, precision is lost. So far, we have not reached this problem but it would expect to occur at some point. Further to this, I did attempt to use libraries that were designed to work around this (BigInteger), unfortunately the speed was so slow it simply became infeasible. Thankfully for any digits that do cause this to occur we have a non-Javascript based solution to generate these digits.

Geek mode: Anything interesting? Yes! The problem of trust. Hopefully overcome due to a beautiful feature of BBP. As the algorithm does not simply generate one digit, but instead generates a series I am able to verify each node's work against roughly 10 other nodes. Secondly, I try to avoid any node ever generating consecutive digits to reduce the ability for a run to occur. Hopefully with these two factors the risks of the rather open nature of doing an experiment like this is countered. Regardless, please don't try... I would like to use these results. However, someone observant could view this as an open source attempt at generating Pi as after all the algorithm is public, the database protocol is public... what more do you need? :)

Also! When comparing the speed of this implementation to my implementation in other interpretted languages (Python and Java), the speed comparison is quite similar.