We’ve upgraded this website with a modern design! Now the backend runs in Cloud Functions (2nd gen) in three regions (US, Europe, Asia). To learn more about the architecture, check out the Serving the Pi section. We’ve also published the entire source code of the demos and the infrastructure, including Terraform scripts on GitHub.
To learn more about the experiments for Pi Day 2022, check out our blog article.
We are serving 50 trillon digits of pi on this website. You can also download the files for yourself if you want to, but beware it’s 40 TB!
The digits are kindly donated by the former world record holder Timothy Mullican. He physically shipped the drives to us so that we could store them in Cloud. We received eight disks.
We also had an opportunity to interview Timothy for Pi Day 2020. Check out this video if you want to hear two world record breakers discuss about pi!
What does Pi sound like? Each Pi digit is converted to a musical note so you can get to know Pi via music!
Piano Genie is an neural network model that allows you to play a note from 1 to 8, and intelligently map it to a great sounding piano performance. In this demo, we use each digit for [0, 7] and reuse the last digit for [8, 9], and use Piano Genie to map to the next logical note for great sounding Pi.
With 50 trillion digits and playing at 314 BPM, it'll play for 302 758.898 years!
This demo is turned off on mobile devices. Please use the latest desktop Chrome browser for the best experience.
Visualize transitions from one digit to the next in Pi using D3.js. Each transition draws a line from a digit in the circle to another digit. Once you have a large amount of digits you can see which digits transition more often and which digits are more common.
For Google Cloud Next 2019 in San Francisco, a team created the Pi Experiment Showcase, and uses the Pi API & generative algorithm to generate unique art pieces for each of the 31.4 trillion digits of Pi.
Here is an art piece to the first 11 digits of e (2.7182818284):
Learn more about the world record & generate your own unique art piece from the Pi Experiment Showcase.
Get Pi Digits
Returns digits of Pi based on the
start digit position and
There is no SLA on this service. We may require an API key in the future & or turn off the service. This is not an official Google API.
We can use curl call the API from the command line.
fetch("https://api.pi.delivery/v1/pi?start=0&numberOfDigits=100") .then(response => response.json()) .then(data => console.log(data));
The response looks like this.
The API also supports hexadecimal digits of pi. Use the
radix parameter to specify the base.
It will return a hexadecimal representation of pi.
This demo uses the REST API to fetch 100 digits of Pi from the specified starting point. You can also try getting the hexadecimal digits of pi.
We developed the REST API in Go and running the program in Cloud Functions (2nd gen).
The architecture looks like this:
We have the same function deployed in three regions (US, Belgium, Japan) that fetches digits from a Cloud Storage bucket in the US multi-region. The API endpoint,
api.pi.delivery is exposed via a Global HTTP(s) Load Balancer. The authorative DNS servers are provided by Cloud DNS.
Finally, this site is hosted on Firebase Hosting, which not only automatically serves the static content via a CDN, it also automatically provisions a SSL certificate for the custom domain!
We have the entire source code published on GitHub including Terraform scripts that we use to provision the infrastructure.
In 2019, Emma Haruka Iwao broke the Pi digits world record by computing 31,415,926,535,897 digits of Pi using Google Cloud Platform! Learn more details from Emma’s Calculating a record-breaking 31.4 trillion digits blog, and Alex Yee (creator of y-cruncher)’s Google Cloud Topples the Pi record article.
Back in 2017, we used y-cruncher to calculate 750 billion digits of Pi on Google Compute Engine. We used a 64-core instance, with 416GB of RAM, and tons of Local SSD + Persistent SSD.
At its peak CPU utilization, it consumed all 64 cores, and 5+TB of SSD storage.
In 2018, we were able to recalculate 750 billion digits in just 10 hours!
Happy #PiDay! We just calculated 750-billion digits of Pi calculation in 10 hours (compared to 2-days it took in 2017) using something we'll announce soon on @GCPcloud. Stayed tuned! #PiDay2018 pic.twitter.com/lFfSv63EzL— Ray Tsang (@saturnism) March 14, 2018
We also calculated 1 trillion digits of Pi using a 96-core 14TB
We are part of the Google Cloud Platform Developer Advocacy team.
Since 2015, different members of the team worked on different Pi Day demos!
In 2022, Sara Ford and Ben Bleything calculated 64 million digits of π using Cloud Functions (2nd gen). Emma Haruka Iwao rebuilt the API with Cloud Functions and the demos with React. We also made the source code available on GitHub.
In 2020, we updated the Pi digits to 50 trillion digits, and added Machine Learning models to generate even better Pi music.
In 2019, the Pi digits world record was broken by Emma Haruka Iwao. Google Cloud Experiment for Pi Day was created by Mathias Paumgarten. The Pi API was updated to serve all 31.4+ trillion digits by Ray Tsang.
In 2018, the Pi API was updated to serve 1 trillion digits by Ray Tsang.
In 2016, we calculated 500 billion digits of Pi and made it searchable. The indexing peaked at 2-million writes per second. You can learn more how we did that in the blog Calculating and searching 500 billion digits of Pi, by Francesc Campoy, Jen Tong, Ray Tsang, Sara Robinson.
The source code for the REST API and demos are available on GitHub.