<s>[INST] how is the precise value of pi calculated? [/INST] There are several different ways to calculate pi, but since pi has an infinite number of decimal places it is impossible to obtain a definitive answer. A simple way to calculate pi is to use the Gregory-Leibniz series. To do this you need to calculate this formula: π=(4/1)-(4/3)+(4/5)-(4/7)+(4/9)-(4/11)+(4/13)-(4/15) ⋯
The longer the formula you use, the more precise the answer will be.</s>\ <s>[INST] I know that there exist supercomputers that compute new digits to Pi. They must have some algorithm to compute Pi. Can you tell me which algorithm these supercomputers use? [/INST] The algorithm for calculating the digits of pi that is most often used by supercomputers is the Chudnovsky algorithm, which is based on Ramanujan’s pi formula. It has been used in most of the recent world record calculations, such as calculating 100 trillion digits of pi, which was achieved on March 21, 2022. The algorithm has a time complexity of O(n(log n)^3).</s>