# New world record for calculating the number of pi: 31.4 trillion characters

*The Bailey-Borwain-Pluff formula, which allows you to extract any specific hexadecimal or binary digit of the pi number without calculating the previous ones (the current record was set on the Chudnovsky algorithm, see under the cut) The*

Google Compute Engine computing cluster calculated the largest number of 121 virtual computers in 121 days digits in the number of pi, setting a new world record: 31.4 trillion decimal places. This is the first time that public cloud software has been used to calculate pi of this magnitude.

The record will be recorded in the name of Emma Haruka Iwao from the high performance computing division at Google. It was she who used the Google Cloud infrastructure for computing. The previous world record was set by Peter Trump in 2016, he calculated the number up to 22.4 trillion digits on a specially made server , which was also sponsored by the employer.

Like Trub, a Google engineer used y-cruncher to calculate. This program uses the Chudnovsky algorithm , a fast algorithm for calculating the number pi. Back in the 80s, the Chudnovsky brothers themselves with its help calculated a billion decimal places.

In turn, the algorithm is based on the property of fast convergence of the hypergeometric series:

Emma Haruka Iwao was carried away by the "magic" number, learning about it in a math class at school, writes

*Wired*. At the university, one of its professors, Daisuke Takahashi, was the record holder for the number of digits calculated using a supercomputer. Today, almost any interested engineer who has access to serious computing resources and large disk storage (to store the result of calculations) can set a record. Created in 2009, the y-cruncher program is designed to calculate mathematical constants, such as pi. It supports massive multithreading and trillion ranges. This program actually commoditized constant calculations.

“You need a pretty big computer to break the world record,” Iwao says. “It will not be possible to do this on the computer from the store, so people used to build custom cars.” In September 2018, Iwao began to consider how the calculation process would technically work in a range outside the record range. It immediately became clear that the main problem would be the amount of data to store. As a result, it turned out that the calculated result takes 170 terabytes. Instead of building a custom server, like its predecessors, the girl used the Google Cloud infrastructure.

Iwao picked up 25 virtual machines: “But instead of pressing this button on the virtual machine 25 times, I automated it,” she explains. “You can do it in a couple of minutes, but if you need so many computers, it will take several days to set everything up.” Iwao then managed the y-cruncher on these 25 virtual machines continuously for 121 days.

For the calculations to be correct, virtual machines had to work continuously. The engineer installed a monitoring system that would warn her if something went wrong, for example, about a sudden failure on one of the virtual machines. Just one accident - even for a couple of minutes - could jeopardize the entire process of computing, if not for the backup.

“The cruncher and Google Cloud have backup systems, and I set them up so that you can instantly take copies of these discs without stopping the calculation,” Iwao says. This data was then copied and stored externally, on other disks, as snapshots.

“In the beginning, there were several parameters that I changed, for example, how much data you could read or write at a time, and how the boundaries would change as you increase,” Iwao says.

As the number of digits increased, the file size became larger, and the computational complexity increased nonlinearly. This greatly complicated the initial calculation when Iwao tried to figure out what resource of virtual machines she would need for the project.

Now calculations and verification of the result are completed: two basic algorithms are built into the y-cruncher - one for calculating the pi itself and the other for checking. The verification algorithm works in parallel with the calculation, but calculates only one digit, so that the record can be registered officially.

Theoretically, a new world record can be set if you just take the previous file and apply the Bailey – Borwain – Pluff formula to calculate another number. But this certainly contradicts the rules for registering such world records: most likely, each applicant must start the calculation again. As an option: to improve the previous achievement by N%, which, according to the Bailey – Borwain – Pluff formula, cannot be done.