Approximations of π
Part of a series of articles on the 
mathematical constant π 

3.1415926535897932384626433... 
Uses 
Properties 
Value 
People 
History 
In culture 
Related topics 
Approximations for the mathematical constant pi (π) in the history of mathematics reached an accuracy within 0.04% of the true value before the beginning of the Common Era. In Chinese mathematics, this was improved to approximations correct to what corresponds to about seven decimal digits by the 5th century.
Further progress was not made until the 15th century (through the efforts of Jamshīd alKāshī). Early modern mathematicians reached an accuracy of 35 digits by the beginning of the 17th century ( Ludolph van Ceulen), and 126 digits by the 19th century ( Jurij Vega), surpassing the accuracy required for any conceivable application outside of pure mathematics.
The record of manual approximation of π is held by William Shanks, who calculated 527 digits correctly in the years preceding 1873. Since the middle of the 20th century, the approximation of π has been the task of electronic digital computers (for a comprehensive account, see Chronology of computation of π). On August 16, 2021, the current record was established by Thomas Keller and Heiko Rölke of the University of Applied Sciences of the Grisons with 62.8 trillion digits.^{ [1]}
Early history
The best known approximations to π dating to before the Common Era were accurate to two decimal places; this was improved upon in Chinese mathematics in particular by the midfirst millennium, to an accuracy of seven decimal places. After this, no further progress was made until the late medieval period.
Some Egyptologists^{ [2]} have claimed that the ancient Egyptians used an approximation of π as 22⁄7 = 3.142857 (about 0.04% too high) from as early as the Old Kingdom.^{ [3]} This claim has met with skepticism.^{ [4]}^{ [5]}
Babylonian mathematics usually approximated π to 3, sufficient for the architectural projects of the time (notably also reflected in the description of Solomon's Temple in the Hebrew Bible).^{ [6]} The Babylonians were aware that this was an approximation, and one Old Babylonian mathematical tablet excavated near Susa in 1936 (dated to between the 19th and 17th centuries BCE) gives a better approximation of π as 25⁄8 = 3.125, about 0.528 percent below the exact value.^{ [7]}^{ [8]}^{ [9]}^{ [10]}
At about the same time, the Egyptian Rhind Mathematical Papyrus (dated to the Second Intermediate Period, c. 1600 BCE, although stated to be a copy of an older, Middle Kingdom text) implies an approximation of π as 256⁄81 ≈ 3.16 (accurate to 0.6 percent) by calculating the area of a circle via approximation with the octagon.^{ [4]}^{ [11]}
Astronomical calculations in the Shatapatha Brahmana (c. 6th century BCE) use a fractional approximation of 339⁄108 ≈ 3.139.^{ [12]}
In the 3rd century BCE, Archimedes proved the sharp inequalities 223⁄71 < π < 22⁄7, by means of regular 96gons (accuracies of 2·10^{−4} and 4·10^{−4}, respectively).^{ [13]}
In the 2nd century CE, Ptolemy used the value 377⁄120, the first known approximation accurate to three decimal places (accuracy 2·10^{−5}).^{ [14]} It is equal to which is accurate to two sexagesimal digits.
The Chinese mathematician Liu Hui in 263 CE computed π to between 3.141024 and 3.142708 by inscribing a 96gon and 192gon; the average of these two values is 3.141866 (accuracy 9·10^{−5}). He also suggested that 3.14 was a good enough approximation for practical purposes. He has also frequently been credited with a later and more accurate result, π ≈ 3927⁄1250 = 3.1416 (accuracy 2·10^{−6}), although some scholars instead believe that this is due to the later (5thcentury) Chinese mathematician Zu Chongzhi.^{ [15]} Zu Chongzhi is known to have computed π to be between 3.1415926 and 3.1415927, which was correct to seven decimal places. He also gave two other approximations of π: π ≈ 22⁄7 and π ≈ 355⁄113, which are not as accurate as his decimal result. The latter fraction is the best possible rational approximation of π using fewer than five decimal digits in the numerator and denominator. Zu Chongzhi's results surpass the accuracy reached in Hellenistic mathematics, and would remain without improvement for close to a millennium.
In Guptaera India (6th century), mathematician Aryabhata in his astronomical treatise Āryabhaṭīya calculated the value of π to five significant figures π ≈ 62832⁄20000 = 3.1416,^{ [16]}^{ [17]} using it to calculate an approximation of the Earth's circumference.^{ [18]} Aryabhata stated that his result "approximately" (āsanna "approaching") gave the circumference of a circle. His 15thcentury commentator Nilakantha Somayaji ( Kerala school of astronomy and mathematics) has argued that the word means not only that this is an approximation, but that the value is incommensurable (irrational).^{ [19]}
Middle Ages
By the 5th century CE, π was known to about seven digits in Chinese mathematics, and to about five digits in Indian mathematics. Further progress was not made for nearly a millennium, until the 14th century, when Indian mathematician and astronomer Madhava of Sangamagrama, founder of the Kerala school of astronomy and mathematics, found the Maclaurin series for arctangent, and then two infinite series for π.^{ [20]}^{ [21]}^{ [22]} One of them is now known as the Madhava–Leibniz series, based on
The other was based on
He used the first 21 terms to compute an approximation of π correct to 11 decimal places as 3.14159265359.
He also improved the formula based on arctan(1) by including a correction:
It is not known how he came up with this correction.^{ [21]} Using this he found an approximation of π to 13 decimal places of accuracy when n = 75.
Jamshīd alKāshī (Kāshānī), a Persian astronomer and mathematician, correctly computed the fractional part of 2π to 9 sexagesimal digits in 1424,^{ [23]} and translated this into 16 decimal digits^{ [24]} after the decimal point:
which gives 16 correct digits for π after the decimal point:
He achieved this level of accuracy by calculating the perimeter of a regular polygon with 3 × 2^{28} sides.^{ [25]}
16th to 19th centuries
In the second half of the 16th century, the French mathematician François Viète discovered an infinite product that converged on π known as Viète's formula.
The GermanDutch mathematician Ludolph van Ceulen (circa 1600) computed the first 35 decimal places of π with a 2^{62}gon. He was so proud of this accomplishment that he had them inscribed on his tombstone.^{ [26]}
In Cyclometricus (1621), Willebrord Snellius demonstrated that the perimeter of the inscribed polygon converges on the circumference twice as fast as does the perimeter of the corresponding circumscribed polygon. This was proved by Christiaan Huygens in 1654. Snellius was able to obtain seven digits of π from a 96sided polygon.^{ [27]}
In 1789, the Slovene mathematician Jurij Vega calculated the first 140 decimal places for π, of which the first 126 were correct^{ [28]} and held the world record for 52 years until 1841, when William Rutherford calculated 208 decimal places, of which the first 152 were correct. Vega improved John Machin's formula from 1706 and his method is still mentioned today.^{[ citation needed]}
The magnitude of such precision (152 decimal places) can be put into context by the fact that the circumference of the largest known object, the observable universe, can be calculated from its diameter (93 billion lightyears) to a precision of less than one Planck length (at 1.6162×10^{−35} meters, the shortest unit of length expected to be directly measurable) using π expressed to just 62 decimal places.^{ [29]}
The English amateur mathematician William Shanks, a man of independent means, spent over 15 years calculating π to 607 decimal places. This was accomplished in 1873, with the first 527 places correct.^{ [30]} He would calculate new digits all morning and would then spend all afternoon checking his morning's work. This was the longest expansion of π until the advent of the electronic digital computer threequarters of a century later.^{[ citation needed]}
20th and 21st centuries
In 1910, the Indian mathematician Srinivasa Ramanujan found several rapidly converging infinite series of π, including
which computes a further eight decimal places of π with each term in the series. His series are now the basis for the fastest algorithms currently used to calculate π. Even using just the first term gives
From the mid20th century onwards, all calculations of π have been done with the help of calculators or computers.
In 1944, D. F. Ferguson, with the aid of a mechanical desk calculator, found that William Shanks had made a mistake in the 528th decimal place, and that all succeeding digits were incorrect.
In the early years of the computer, an expansion of π to 100000 decimal places^{ [31]}^{: 78 } was computed by Maryland mathematician Daniel Shanks (no relation to the aforementioned William Shanks) and his team at the United States Naval Research Laboratory in Washington, D.C. In 1961, Shanks and his team used two different power series for calculating the digits of π. For one, it was known that any error would produce a value slightly high, and for the other, it was known that any error would produce a value slightly low. And hence, as long as the two series produced the same digits, there was a very high confidence that they were correct. The first 100,265 digits of π were published in 1962.^{ [31]}^{: 80–99 } The authors outlined what would be needed to calculate π to 1 million decimal places and concluded that the task was beyond that day's technology, but would be possible in five to seven years.^{ [31]}^{: 78 }
In 1989, the Chudnovsky brothers computed π to over 1 billion decimal places on the supercomputer IBM 3090 using the following variation of Ramanujan's infinite series of π:
Records since then have all been accomplished using the Chudnovsky algorithm. In 1999, Yasumasa Kanada and his team at the University of Tokyo computed π to over 200 billion decimal places on the supercomputer HITACHI SR8000/MPP (128 nodes) using another variation of Ramanujan's infinite series of π. In November 2002, Yasumasa Kanada and a team of 9 others used the Hitachi SR8000, a 64node supercomputer with 1 terabyte of main memory, to calculate π to roughly 1.24 trillion digits in around 600 hours (25 days).^{ [32]}
Recent Records
 In August 2009, a Japanese supercomputer called the T2K Open Supercomputer more than doubled the previous record by calculating π to roughly 2.6 trillion digits in approximately 73 hours and 36 minutes.
 In December 2009, Fabrice Bellard used a home computer to compute 2.7 trillion decimal digits of π. Calculations were performed in base 2 (binary), then the result was converted to base 10 (decimal). The calculation, conversion, and verification steps took a total of 131 days.^{ [33]}
 In August 2010, Shigeru Kondo used Alexander Yee's ycruncher to calculate 5 trillion digits of π. This was the world record for any type of calculation, but significantly it was performed on a home computer built by Kondo.^{ [34]} The calculation was done between 4 May and 3 August, with the primary and secondary verifications taking 64 and 66 hours respectively.^{ [35]}
 In October 2011, Shigeru Kondo broke his own record by computing ten trillion (10^{13}) and fifty digits using the same method but with better hardware.^{ [36]}^{ [37]}
 In December 2013, Kondo broke his own record for a second time when he computed 12.1 trillion digits of π.^{ [38]}
 In October 2014, Sandon Van Ness, going by the pseudonym "houkouonchi" used ycruncher to calculate 13.3 trillion digits of π.^{ [39]}
 In November 2016, Peter Trueb and his sponsors computed on ycruncher and fully verified 22.4 trillion digits of π (22,459,157,718,361 (π^{e} × 10^{12})).^{ [40]} The computation took (with three interruptions) 105 days to complete,^{ [39]} the limitation of further expansion being primarily storage space.^{ [38]}
 In March 2019, Emma Haruka Iwao, an employee at Google, computed 31.4 trillion digits of pi using ycruncher and Google Cloud machines. This took 121 days to complete.^{ [41]}
 In January 2020, Timothy Mullican announced the computation of 50 trillion digits over 303 days.^{ [42]}^{ [43]}
 On August 14, 2021, a team (DAViS) at the University of Applied Sciences of the Grisons announced completion of the computation of π to 62.8 trillion digits.^{ [44]}^{ [45]}
Practical approximations
Depending on the purpose of a calculation, π can be approximated by using fractions for ease of calculation. The most notable such approximations are 22⁄7 ( relative error of about 4·10^{−4}) and 355⁄113 (relative error of about 8·10^{−8}).^{ [46]}^{ [47]}^{ [48]}
Nonmathematical "definitions" of π
Of some notability are legal or historical texts purportedly "defining π" to have some rational value, such as the " Indiana Pi Bill" of 1897, which stated "the ratio of the diameter and circumference is as fivefourths to four" (which would imply "π = 3.2") and a passage in the Hebrew Bible that implies that π = 3.
Indiana bill
The socalled " Indiana Pi Bill" of 1897 has often been characterized as an attempt to "legislate the value of Pi". Rather, the bill dealt with a purported solution to the problem of geometrically " squaring the circle".^{ [49]}
The bill was nearly passed by the Indiana General Assembly in the U.S., and has been claimed to imply a number of different values for π, although the closest it comes to explicitly asserting one is the wording "the ratio of the diameter and circumference is as fivefourths to four", which would make π = 16⁄5 = 3.2, a discrepancy of nearly 2 percent. A mathematics professor who happened to be present the day the bill was brought up for consideration in the Senate, after it had passed in the House, helped to stop the passage of the bill on its second reading, after which the assembly thoroughly ridiculed it before tabling it indefinitely.
Imputed biblical value
It is sometimes claimed that the Hebrew Bible implies that "π equals three", based on a passage in 1 Kings 7:23 and 2 Chronicles 4:2 giving measurements for the round basin located in front of the Temple in Jerusalem as having a diameter of 10 cubits and a circumference of 30 cubits.
The issue is discussed in the Talmud and in Rabbinic literature.^{ [50]} Among the many explanations and comments are these:
 Rabbi Nehemiah explained this in his Mishnat haMiddot (the earliest known Hebrew text on geometry, ca. 150 CE) by saying that the diameter was measured from the outside rim while the circumference was measured along the inner rim. This interpretation implies a brim about 0.225 cubit (or, assuming an 18inch "cubit", some 4 inches), or one and a third " handbreadths," thick (cf. NKJV and NKJV).
 Maimonides states (ca. 1168 CE) that π can only be known approximately, so the value 3 was given as accurate enough for religious purposes. This is taken by some^{ [51]} as the earliest assertion that π is irrational.
There is still some debate on this passage in biblical scholarship.^{[ failed verification]}^{ [52]}^{ [53]} Many reconstructions of the basin show a wider brim (or flared lip) extending outward from the bowl itself by several inches to match the description given in NKJV^{ [54]} In the succeeding verses, the rim is described as "a handbreadth thick; and the brim thereof was wrought like the brim of a cup, like the flower of a lily: it received and held three thousand baths" NKJV, which suggests a shape that can be encompassed with a string shorter than the total length of the brim, e.g., a Lilium flower or a Teacup.
Development of efficient formulae
Polygon approximation to a circle
Archimedes, in his Measurement of a Circle, created the first algorithm for the calculation of π based on the idea that the perimeter of any (convex) polygon inscribed in a circle is less than the circumference of the circle, which, in turn, is less than the perimeter of any circumscribed polygon. He started with inscribed and circumscribed regular hexagons, whose perimeters are readily determined. He then shows how to calculate the perimeters of regular polygons of twice as many sides that are inscribed and circumscribed about the same circle. This is a recursive procedure which would be described today as follows: Let p_{k} and P_{k} denote the perimeters of regular polygons of k sides that are inscribed and circumscribed about the same circle, respectively. Then,
Archimedes uses this to successively compute P_{12}, p_{12}, P_{24}, p_{24}, P_{48}, p_{48}, P_{96} and p_{96}.^{ [55]} Using these last values he obtains
It is not known why Archimedes stopped at a 96sided polygon; it only takes patience to extend the computations. Heron reports in his Metrica (about 60 CE) that Archimedes continued the computation in a now lost book, but then attributes an incorrect value to him.^{ [56]}
Archimedes uses no trigonometry in this computation and the difficulty in applying the method lies in obtaining good approximations for the square roots that are involved. Trigonometry, in the form of a table of chord lengths in a circle, was probably used by Claudius Ptolemy of Alexandria to obtain the value of π given in the Almagest (circa 150 CE).^{ [57]}
Advances in the approximation of π (when the methods are known) were made by increasing the number of sides of the polygons used in the computation. A trigonometric improvement by Willebrord Snell (1621) obtains better bounds from a pair of bounds obtained from the polygon method. Thus, more accurate results were obtained from polygons with fewer sides.^{ [58]} Viète's formula, published by François Viète in 1593, was derived by Viète using a closely related polygonal method, but with areas rather than perimeters of polygons whose numbers of sides are powers of two.^{ [59]}
The last major attempt to compute π by this method was carried out by Grienberger in 1630 who calculated 39 decimal places of π using Snell's refinement.^{ [58]}
Machinlike formula
For fast calculations, one may use formulae such as Machin's:
together with the Taylor series expansion of the function arctan(x). This formula is most easily verified using polar coordinates of complex numbers, producing:
({x,y} = {239, 13^{2}} is a solution to the Pell equation x^{2}−2y^{2} = −1.)
Formulae of this kind are known as Machinlike formulae. Machin's particular formula was used well into the computer era for calculating record numbers of digits of π,^{ [31]} but more recently other similar formulae have been used as well.
For instance, Shanks and his team used the following Machinlike formula in 1961 to compute the first 100,000 digits of π:^{ [31]}
and they used another Machinlike formula,
as a check.
The record as of December 2002 by Yasumasa Kanada of Tokyo University stood at 1,241,100,000,000 digits. The following Machinlike formulae were used for this:
K. Takano (1982).
F. C. M. Størmer (1896).
Other classical formulae
Other formulae that have been used to compute estimates of π include:
Liu Hui (see also Viète's formula):
Newton / Euler Convergence Transformation:^{ [60]}
where (2k + 1)!! denotes the product of the odd integers up to 2k + 1.
David Chudnovsky and Gregory Chudnovsky:
Ramanujan's work is the basis for the Chudnovsky algorithm, the fastest algorithms used, as of the turn of the millennium, to calculate π.
Modern algorithms
Extremely long decimal expansions of π are typically computed with iterative formulae like the Gauss–Legendre algorithm and Borwein's algorithm. The latter, found in 1985 by Jonathan and Peter Borwein, converges extremely quickly:
For and
where , the sequence converges quartically to π, giving about 100 digits in three steps and over a trillion digits after 20 steps. The Gauss–Legendre algorithm (with time complexity , using Harvey–Hoeven multiplication algorithm) is asymptotically faster than the Chudnovsky algorithm (with time complexity ) – but which of these algorithms is faster in practice for "small enough" depends on technological factors such as memory sizes and access times.^{ [61]} For breaking world records, the iterative algorithms are used less commonly than the Chudnovsky algorithm since they are memoryintensive.
The first one million digits of π and 1⁄π are available from Project Gutenberg (see external links below). A former calculation record (December 2002) by Yasumasa Kanada of Tokyo University stood at 1.24 trillion digits, which were computed in September 2002 on a 64node Hitachi supercomputer with 1 terabyte of main memory, which carries out 2 trillion operations per second, nearly twice as many as the computer used for the previous record (206 billion digits). The following Machinlike formulae were used for this:
 ( Kikuo Takano (1982))
 ( F. C. M. Størmer (1896)).
These approximations have so many digits that they are no longer of any practical use, except for testing new supercomputers.^{ [62]} Properties like the potential normality of π will always depend on the infinite string of digits on the end, not on any finite computation.
Miscellaneous approximations
Historically, base 60 was used for calculations. In this base, π can be approximated to eight (decimal) significant figures with the number 3;8,29,44_{60}, which is
(The next sexagesimal digit is 0, causing truncation here to yield a relatively good approximation.)
In addition, the following expressions can be used to estimate π:
 accurate to three digits:
 accurate to three digits:
 Karl Popper conjectured that Plato knew this expression, that he believed it to be exactly π, and that this is responsible for some of Plato's confidence in the omnicompetence of mathematical geometry—and Plato's repeated discussion of special right triangles that are either isosceles or halves of equilateral triangles.
 Szyszkowicz: ^{
[63]}
 accurate to four digits:
 ^{ [64]}
 accurate to four digits (or five significant figures):
 ^{ [65]}
 an approximation by Ramanujan, accurate to 4 digits (or five significant figures):
 accurate to five digits:
 accurate to six digits [1]:
 accurate to seven digits:
 accurate to nine digits:
 This is from Ramanujan, who claimed the Goddess of Namagiri appeared to him in a dream and told him the true value of π.^{ [66]}
 accurate to ten digits:
 accurate to ten digits (or eleven significant figures):
 This curious approximation follows the observation that the 193rd power of 1/π yields the sequence 1122211125... Replacing 5 by 2 completes the symmetry without reducing the correct digits of π, while inserting a central decimal point remarkably fixes the accompanying magnitude at 10^{100}.^{ [67]}
 accurate to 18 digits:
 ^{ [68]}
 This is based on the fundamental discriminant d = 3(89) = 267 which has class number h(d) = 2 explaining the algebraic numbers of degree 2. The core radical is 5^{3} more than the fundamental unit which gives the smallest solution { x, y} = {500, 53} to the Pell equation x^{2} − 89y^{2} = −1.
 accurate to 30 decimal places:
 Derived from the closeness of Ramanujan constant to the integer 640320^{3}+744. This does not admit obvious generalizations in the integers, because there are only finitely many Heegner numbers and negative discriminants d with class number h(−d) = 1, and d = 163 is the largest one in absolute value.
 accurate to 52 decimal places:
 Like the one above, a consequence of the jinvariant. Among negative discriminants with class number 2, this d the largest in absolute value.
 accurate to 161 decimal places:
 where u is a product of four simple quartic units,
 and,
 Based on one found by Daniel Shanks. Similar to the previous two, but this time is a quotient of a modular form, namely the Dedekind eta function, and where the argument involves . The discriminant d = 3502 has h(−d) = 16.
 The continued fraction representation of π can be used to generate successive best rational approximations. These approximations are the best possible rational approximations of π relative to the size of their denominators. Here is a list of the first thirteen of these:^{ [69]}^{ [70]}
 Of all of these, is the only fraction in this sequence that gives more exact digits of π (i.e. 7) than the number of digits needed to approximate it (i.e. 6). The accuracy can be improved by using other fractions with larger numerators and denominators, but, for most such fractions, more digits are required in the approximation than correct significant figures achieved in the result.^{ [71]}
Summing a circle's area
Pi can be obtained from a circle if its radius and area are known using the relationship:
If a circle with radius r is drawn with its center at the point (0, 0), any point whose distance from the origin is less than r will fall inside the circle. The Pythagorean theorem gives the distance from any point (x, y) to the center:
Mathematical "graph paper" is formed by imagining a 1×1 square centered around each cell (x, y), where x and y are integers between −r and r. Squares whose center resides inside or exactly on the border of the circle can then be counted by testing whether, for each cell (x, y),
The total number of cells satisfying that condition thus approximates the area of the circle, which then can be used to calculate an approximation of π. Closer approximations can be produced by using larger values of r.
Mathematically, this formula can be written:
In other words, begin by choosing a value for r. Consider all cells (x, y) in which both x and y are integers between −r and r. Starting at 0, add 1 for each cell whose distance to the origin (0,0) is less than or equal to r. When finished, divide the sum, representing the area of a circle of radius r, by r^{2} to find the approximation of π. For example, if r is 5, then the cells considered are:
(−5,5) (−4,5) (−3,5) (−2,5) (−1,5) (0,5) (1,5) (2,5) (3,5) (4,5) (5,5) (−5,4) (−4,4) (−3,4) (−2,4) (−1,4) (0,4) (1,4) (2,4) (3,4) (4,4) (5,4) (−5,3) (−4,3) (−3,3) (−2,3) (−1,3) (0,3) (1,3) (2,3) (3,3) (4,3) (5,3) (−5,2) (−4,2) (−3,2) (−2,2) (−1,2) (0,2) (1,2) (2,2) (3,2) (4,2) (5,2) (−5,1) (−4,1) (−3,1) (−2,1) (−1,1) (0,1) (1,1) (2,1) (3,1) (4,1) (5,1) (−5,0) (−4,0) (−3,0) (−2,0) (−1,0) (0,0) (1,0) (2,0) (3,0) (4,0) (5,0) (−5,−1) (−4,−1) (−3,−1) (−2,−1) (−1,−1) (0,−1) (1,−1) (2,−1) (3,−1) (4,−1) (5,−1) (−5,−2) (−4,−2) (−3,−2) (−2,−2) (−1,−2) (0,−2) (1,−2) (2,−2) (3,−2) (4,−2) (5,−2) (−5,−3) (−4,−3) (−3,−3) (−2,−3) (−1,−3) (0,−3) (1,−3) (2,−3) (3,−3) (4,−3) (5,−3) (−5,−4) (−4,−4) (−3,−4) (−2,−4) (−1,−4) (0,−4) (1,−4) (2,−4) (3,−4) (4,−4) (5,−4) (−5,−5) (−4,−5) (−3,−5) (−2,−5) (−1,−5) (0,−5) (1,−5) (2,−5) (3,−5) (4,−5) (5,−5)
The 12 cells (0, ±5), (±5, 0), (±3, ±4), (±4, ±3) are exactly on the circle, and 69 cells are completely inside, so the approximate area is 81, and π is calculated to be approximately 3.24 because 81⁄5^{2} = 3.24. Results for some values of r are shown in the table below:
r  area  approximation of π 

2  13  3.25 
3  29  3.22222 
4  49  3.0625 
5  81  3.24 
10  317  3.17 
20  1257  3.1425 
100  31417  3.1417 
1000  3141549  3.141549 
For related results see The circle problem: number of points (x,y) in square lattice with x^2 + y^2 <= n.
Similarly, the more complex approximations of π given below involve repeated calculations of some sort, yielding closer and closer approximations with increasing numbers of calculations.
Continued fractions
Besides its simple continued fraction representation [3; 7, 15, 1, 292, 1, 1, ...], which displays no discernible pattern, π has many generalized continued fraction representations generated by a simple rule, including these two.
(Other representations are available at The Wolfram Functions Site.)
Trigonometry
Gregory–Leibniz series
is the power series for arctan(x) specialized to x = 1. It converges too slowly to be of practical interest. However, the power series converges much faster for smaller values of , which leads to formulae where arises as the sum of small angles with rational tangents, known as Machinlike formulae.
Arctangent
Knowing that 4 arctan 1 = π, the formula can be simplified to get:
with a convergence such that each additional 10 terms yields at least three more digits.
Another formula for involving arctangent function is given by
where such that . Approximations can be made by using, for example, the rapidly convergent Euler formula^{ [72]}
Alternatively, the following simple expansion series of the arctangent function can be used
where
to approximate with even more rapid convergence. Convergence in this arctangent formula for improves as integer increases.
The constant can also be expressed by infinite sum of arctangent functions as
and
where is the nth Fibonacci number. However, these two formulae for are much slower in convergence because of set of arctangent functions that are involved in computation.
Arcsine
Observing an equilateral triangle and noting that
yields
with a convergence such that each additional five terms yields at least three more digits.
Digit extraction methods
The Bailey–Borwein–Plouffe formula (BBP) for calculating π was discovered in 1995 by Simon Plouffe. Using base 16 math, the formula can compute any particular digit of π—returning the hexadecimal value of the digit—without having to compute the intervening digits (digit extraction).^{ [73]}
In 1996, Simon Plouffe derived an algorithm to extract the nth decimal digit of π (using base 10 math to extract a base 10 digit), and which can do so with an improved speed of O(n^{3}(log n)^{3}) time. The algorithm requires virtually no memory for the storage of an array or matrix so the onemillionth digit of π can be computed using a pocket calculator.^{ [74]} However, it would be quite tedious and impractical to do so.
The calculation speed of Plouffe's formula was improved to O(n^{2}) by Fabrice Bellard, who derived an alternative formula (albeit only in base 2 math) for computing π.^{ [75]}
Efficient methods
Many other expressions for π were developed and published by Indian mathematician Srinivasa Ramanujan. He worked with mathematician Godfrey Harold Hardy in England for a number of years.
Extremely long decimal expansions of π are typically computed with the Gauss–Legendre algorithm and Borwein's algorithm; the Salamin–Brent algorithm, which was invented in 1976, has also been used.
In 1997, David H. Bailey, Peter Borwein and Simon Plouffe published a paper (Bailey, 1997) on a new formula for π as an infinite series:
This formula permits one to fairly readily compute the kth binary or hexadecimal digit of π, without having to compute the preceding k − 1 digits. Bailey's website^{ [76]} contains the derivation as well as implementations in various programming languages. The PiHex project computed 64 bits around the quadrillionth bit of π (which turns out to be 0).
Fabrice Bellard further improved on BBP with his formula:^{ [77]}
Other formulae that have been used to compute estimates of π include:
This converges extraordinarily rapidly. Ramanujan's work is the basis for the fastest algorithms used, as of the turn of the millennium, to calculate π.
In 1988, David Chudnovsky and Gregory Chudnovsky found an even fasterconverging series (the Chudnovsky algorithm):
 .
The speed of various algorithms for computing pi to n correct digits is shown below in descending order of asymptotic complexity. M(n) is the complexity of the multiplication algorithm employed.
Algorithm  Year  Time complexity or Speed 

Gauss–Legendre algorithm  1975  ^{ [61]} 
Chudnovsky algorithm  1988  ^{ [39]} 
Binary splitting of the arctan series in Machin's formula  ^{ [61]}  
Leibniz formula for π  1300s  Sublinear convergence. Five billion terms for 10 correct decimal places 
Projects
Pi Hex
Pi Hex was a project to compute three specific binary digits of π using a distributed network of several hundred computers. In 2000, after two years, the project finished computing the five trillionth (5*10^{12}), the forty trillionth, and the quadrillionth (10^{15}) bits. All three of them turned out to be 0.
Software for calculating π
Over the years, several programs have been written for calculating π to many digits on personal computers.
General purpose
Most computer algebra systems can calculate π and other common mathematical constants to any desired precision.
Functions for calculating π are also included in many general libraries for arbitraryprecision arithmetic, for instance Class Library for Numbers, MPFR and SymPy.
Special purpose
Programs designed for calculating π may have better performance than generalpurpose mathematical software. They typically implement checkpointing and efficient disk swapping to facilitate extremely longrunning and memoryexpensive computations.
 TachusPi by Fabrice Bellard^{ [78]} is the program used by himself to compute world record number of digits of pi in 2009.
 ycruncher by Alexander Yee^{ [39]} is the program which every world record holder since Shigeru Kondo in 2010 has used to compute world record numbers of digits. ycruncher can also be used to calculate other constants and holds world records for several of them.
 PiFast by Xavier Gourdon was the fastest program for Microsoft Windows in 2003. According to its author, it can compute one million digits in 3.5 seconds on a 2.4 GHz Pentium 4.^{ [79]} PiFast can also compute other irrational numbers like e and √2. It can also work at lesser efficiency with very little memory (down to a few tens of megabytes to compute well over a billion (10^{9}) digits). This tool is a popular benchmark in the overclocking community. PiFast 4.4 is available from Stu's Pi page. PiFast 4.3 is available from Gourdon's page.
 QuickPi by Steve Pagliarulo for Windows is faster than PiFast for runs of under 400 million digits. Version 4.5 is available on Stu's Pi Page below. Like PiFast, QuickPi can also compute other irrational numbers like e, √2, and √3. The software may be obtained from the PiHacks Yahoo! forum, or from Stu's Pi page.
 Super PI by Kanada Laboratory^{ [80]} in the University of Tokyo is the program for Microsoft Windows for runs from 16,000 to 33,550,000 digits. It can compute one million digits in 40 minutes, two million digits in 90 minutes and four million digits in 220 minutes on a Pentium 90 MHz. Super PI version 1.9 is available from Super PI 1.9 page.
See also
Notes
 ^ "Un nouveau record de calcul du nombre Pi établit en Suisse" (in French). RTS Info. 16 August 2021.
 ^ Petrie, W.M.F. (1940). Wisdom of the Egyptians.

^
Verner, Miroslav (2001) [1997]. The Pyramids: The Mystery, Culture, and Science of Egypt's Great Monuments.
Grove Press.
ISBN
9780802139351.
Based on the Great Pyramid of Giza, supposedly built so that the circle whose radius is equal to the height of the pyramid has a circumference equal to the perimeter of the base (it is 1760 cubits around and 280 cubits in height).
 ^ ^{a} ^{b} Rossi (2007). Corinna Architecture and Mathematics in Ancient Egypt. Cambridge University Press. ISBN 9780521690539.
 ^ Legon, J. A. R. (1991). On Pyramid Dimensions and Proportions. Discussions in Egyptology. 20. pp. 25–34.
 ^ See #Imputed biblical value. Beckmann 1971 "There has been concern over the apparent biblical statement of π ≈ 3 from the early times of rabbinical Judaism, addressed by Rabbi Nehemiah in the 2nd century."^{[ page needed]}

^
Romano, David Gilman (1993).
Athletics and Mathematics in Archaic Corinth: The Origins of the Greek Stadion.
American Philosophical Society. p. 78.
ISBN
9780871692061.
A group of mathematical clay tablets from the Old Babylonian Period, excavated at Susa in 1936, and published by E.M. Bruins in 1950, provide the information that the Babylonian approximation of π was 3 1/8 or 3.125.
 ^ Bruins, E. M. (1950). "Quelques textes mathématiques de la Mission de Suse" (PDF).
 ^ Bruins, E. M.; Rutten, M. (1961). Textes mathématiques de Suse. Mémoires de la Mission archéologique en Iran. XXXIV.
 ^ See also Beckmann 1971, pp. 12, 21–22 "in 1936, a tablet was excavated some 200 miles from Babylon. ... The mentioned tablet, whose translation was partially published only in 1950, ... states that the ratio of the perimeter of a regular hexagon to the circumference of the circumscribed circle equals a number which in modern notation is given by 57/60+36/(60)^{2} [i.e. π = 3/0.96 = 25/8]".
 ^ Imhausen, Annette (2007). Katz, Victor J. (ed.). The Mathematics of Egypt, Mesopotamia, China, India, and Islam: A Sourcebook. Princeton University Press. ISBN 9780691114859.
 ^ Chaitanya, Krishna. A profile of Indian culture. Indian Book Company (1975). p. 133.
 ^ Damini, D.B.; Abhishek, Dhar (2020). "How Archimedes showed that π is approximately equal to 22/7". p. 8. arXiv: 2008.07995 [ math.HO].
 ^ Lazarus Mudehwe (February 1997). "The story of pi". Zimaths. Archived from the original on 8 January 2013.
 ^ Lam, Lay Yong; Ang, Tian Se (1986), "Circle measurements in ancient China", Historia Mathematica, 13 (4): 325–340, doi: 10.1016/03150860(86)900558, MR 0875525. Reprinted in Berggren, J. L.; Borwein, Jonathan M.; Borwein, Peter, eds. (2004). Pi: A Source Book. Springer. pp. 20–35. ISBN 9780387205717.. See in particular pp. 333–334 (pp. 28–29 of the reprint).
 ^ How Aryabhata got the earth's circumference right Archived 15 January 2017 at the Wayback Machine

^ Āryabhaṭīya (gaṇitapāda 10):
 chaturadhikam śatamaṣṭaguṇam dvāśaṣṭistathā sahasrāṇām ayutadvayaviṣkambhasyāsanno vr̥ttapariṇahaḥ.
 "Add four to one hundred, multiply by eight and then add sixtytwo thousand. The result is approximately the circumference of a circle of diameter twenty thousand. By this rule the relation of the circumference to diameter is given."
 ^ "Aryabhata the Elder". University of St Andrews, School of Mathematics and Statistics. Retrieved 20 July 2011.
 ^ S. Balachandra Rao (1998). Indian Mathematics and Astronomy: Some Landmarks. Bangalore: Jnana Deep Publications. ISBN 9788173712050.
 ^ George E. Andrews, Ranjan Roy; Richard Askey (1999). Special Functions. Cambridge University Press. p. 58. ISBN 9780521789882.
 ^ ^{a} ^{b} J J O'Connor and E F Robertson (November 2000). "Madhava of Sangamagramma". MacTutor. University of St. Andrews.
 ^ Gupta, R. C. (1992). "On the remainder term in the Madhava–Leibniz's series". Ganita Bharati. 14 (1–4): 68–71.

^ Boris A. Rosenfeld & Adolf P. Youschkevitch (1981). "Ghiyath aldin Jamshid Masud alKashi (or alKashani)". Dictionary of Scientific Biography. Vol. 7. p. 256.
volume=
has extra text ( help)  ^ J J O'Connor and E F Robertson (July 1999). "Ghiyath alDin Jamshid Mas'ud alKashi". MacTutor. University of St. Andrews.
 ^ Azarian, Mohammad K. (2010). "alRisāla almuhītīyya: A Summary". Missouri Journal of Mathematical Sciences. 22 (2): 64–85. doi: 10.35834/mjms/1312233136.

^ Capra, B.
"Digits of Pi" (PDF). Retrieved 13 January 2018. Cite journal requires
journal=
( help)  ^ Chakrabarti, Gopal; Hudson, Richard (2003). "An Improvement of Archimedes Method of Approximating π" (PDF). International Journal of Pure and Applied Mathematics. 7 (2): 207–212.

^ Sandifer, Edward (2007).
"Why 140 Digits of Pi Matter" (PDF). Jurij baron Vega in njegov čas: Zbornik ob 250letnici rojstva [Baron Jurij Vega and His Times: Celebrating 250 Years]. Ljubljana: DMFA. p. 17.
ISBN
9789616137980.
LCCN
2008467244.
OCLC
448882242. Archived from
the original (PDF) on 3 March 2016.
We should note that Vega's value contains an error in the 127th digit. Vega gives a 4 where there should be an [6], and all digits after that are incorrect.
 ^ "What kind of accuracy could one get with Pi to 40 decimal places?". Stack Exchange. 11 May 2015.
 ^ Berlinghoff, William P.; Gouvea, Fernando Q. (2020). Math through the Ages: A Gentle History for Teachers and Others Expanded Second Edition (illustrated, revised ed.). American Mathematical Soc. p. 110. ISBN 9781939512123.
 ^ ^{a} ^{b} ^{c} ^{d} ^{e} Shanks, D.; Wrench, Jr., J. W. (1962). "Calculation of π to 100,000 decimals". Mathematics of Computation. 16 (77): 76–99. doi: 10.2307/2003813. JSTOR 2003813.
 ^ "Announcement at the Kanada lab web site". Supercomputing.org. Archived from the original on 12 March 2011. Retrieved 11 December 2017.
 ^ "Pi Computation Record".
 ^ McCormick Grad Sets New Pi Record Archived 28 September 2011 at the Wayback Machine
 ^ "Pi  5 Trillion Digits".
 ^ Glenn (19 October 2011). "Short Sharp Science: Epic pi quest sets 10 trillion digit record". Newscientist.com. Retrieved 18 April 2016.
 ^ Yee, Alexander J.; Kondo, Shigeru (22 October 2011). "Round 2... 10 Trillion Digits of Pi".
 ^ ^{a} ^{b} Yee, Alexander J.; Kondo, Shigeru (28 December 2013). "12.1 Trillion Digits of Pi".
 ^ ^{a} ^{b} ^{c} ^{d} Yee, Alexander J. (2018). "ycruncher: A MultiThreaded Pi Program". www.numberworld.org. Retrieved 14 March 2018.
 ^ Treub, Peter (30 November 2016). "Digit Statistics of the First 22.4 Trillion Decimal Digits of Pi". arXiv: 1612.00489 [ math.NT].
 ^ "Google Cloud Topples the Pi Record". www.numberworld.org. Retrieved 14 March 2019.
 ^ "The Pi Record Returns to the Personal Computer". Retrieved 30 January 2020.
 ^ "Calculating Pi: My attempt at breaking the Pi World Record". 26 June 2019. Retrieved 30 January 2020.
 ^ "Die FH Graubünden kennt Pi am genauesten  Weltrekord!". Retrieved 31 August 2021.
 ^ "Swiss researchers calculate pi to new record of 62.8tn figures". TheGuardian.com. 16 August 2021. Retrieved 31 August 2021.
 ^ Allain, Rhett (18 March 2011). "What is the Best Fractional Representation of Pi". WIRED. Conde Nast. Retrieved 16 March 2020.
 ^ John D., Cook (22 May 2018). "Best Rational Approximations for Pi". John D. Cook Consulting. Retrieved 16 March 2020.
 ^ "Continued Fraction Approximations to Pi" (PDF). Illinois Department of Mathematics. University of Illinois Board of Trustees. Retrieved 16 March 2020.
 ^ Hallerberg, Arthur E. (1977). "Indiana's Squared Circle". Mathematics Magazine. 50 (3): 136–140. doi: 10.1080/0025570X.1977.11976632.
 ^ Tsaban, Boaz; Garber, David (February 1998). "On the rabbinical approximation of π" (PDF). Historia Mathematica. 25 (1): 75–84. doi: 10.1006/hmat.1997.2185. ISSN 03150860. Retrieved 14 July 2009.
 ^ Wilbur Richard Knorr, The Ancient Tradition of Geometric Problems, New York: Dover Publications, 1993.
 ^ Aleff, H. Peter. "Ancient Creation Stories told by the Numbers: Solomon's Pi". recoveredscience.com. Archived from the original on 14 October 2007. Retrieved 30 October 2007.
 ^ O'Connor, J J; E F Robertson (August 2001). "A history of Pi". Archived from the original on 30 October 2007. Retrieved 30 October 2007.
 ^ Math Forum – Ask Dr. Math
 ^ Eves 1992, p. 131
 ^ Beckmann 1971, p. 66
 ^ Eves 1992, p. 118
 ^ ^{a} ^{b} Eves 1992, p. 119
 ^ Beckmann 1971, pp. 94–95
 ^ "Pi Formulas  from Wolfram MathWorld". Mathworld.wolfram.com. 13 April 2016. Retrieved 18 April 2016.
 ^ ^{a} ^{b} ^{c} Trueb, Peter (2020). The Borwein brothers, Pi and the AGM. Springer Proceedings in Mathematics & Statistics. 313. arXiv: 1802.07558. doi: 10.1007/9783030365684. ISBN 9783030365677. S2CID 214742997.
 ^ "What can you do with a supercomputer?  ExtremeTech".
 ^ Szyszkowicz, Mieczyslaw (2021). "The number pi from a square root of 2 and 3". East European Scientific Journal (70): 34–36. doi: 10.31618/ESSA.27821994.2021.1.70.68.

^
Gardner, Martin (1995). "New Mathematical Diversions". Mathematical Association of America: 92. Cite journal requires
journal=
( help)  ^ A nested radical approximation for π Archived 6 July 2011 at the Wayback Machine
 ^ "Lost notebook page 16", Ramanujan
 ^ Hoffman, D.W. College Mathematics Journal, 40 (2009) 399
 ^ "Mathematics".
 ^ Sloane, N. J. A. (ed.). "Sequence A002485 (Numerators of convergents to Pi)". The OnLine Encyclopedia of Integer Sequences. OEIS Foundation.
 ^ Sloane, N. J. A. (ed.). "Sequence A002486 (Denominators of convergents to Pi)". The OnLine Encyclopedia of Integer Sequences. OEIS Foundation.
 ^ "Fractional Approximations of Pi".
 ^ Hwang ChienLih (2005), "An elementary derivation of Euler's series for the arctangent function", The Mathematical Gazette, 89 (516): 469–470, doi: 10.1017/S0025557200178404, S2CID 123395287
 ^ MathWorld: BBP Formula Wolfram.com
 ^ Plouffe, Simon (2009). "On the computation of the n^th decimal digit of various transcendental numbers". arXiv: 0912.0303v1 [ math.NT].
 ^ Bellard's Website: Bellard.org
 ^ "David H Bailey". crd.LBL.gov. Retrieved 11 December 2017.
 ^ "The world of Pi  Bellard". Pi314.net. 13 April 2013. Retrieved 18 April 2016.
 ^ Bellard, Fabrice. "TachusPi". Retrieved 20 March 2020.
 ^ " PiFast timings"
 ^ Takahashi, Daisuke; Kanada, Yasumasa (10 August 2010). "Kanada Laboratory home page". University of Tokyo. Archived from the original on 24 August 2011. Retrieved 1 May 2011.
References
 Bailey, David H.; Borwein, Peter B. & Plouffe, Simon (April 1997). "On the Rapid Computation of Various Polylogarithmic Constants" (PDF). Mathematics of Computation. 66 (218): 903–913. Bibcode: 1997MaCom..66..903B. doi: 10.1090/S0025571897008569.
 Beckmann, Petr (1971). A History of π. New York: St. Martin's Press. ISBN 9780880294188. MR 0449960.
 Eves, Howard (1992). An Introduction to the History of Mathematics (6th ed.). Saunders College Publishing. ISBN 9780030295584.
 Joseph, George G. (2000). The Crest of the Peacock: NonEuropean Roots of Mathematics (New ed., London : Penguin ed.). London: Penguin. ISBN 9780140277784.
 Jackson, K; Stamp, J. (2002). Pyramid: Beyond Imagination. Inside the Great Pyramid of Giza. London: BBC.^{[ ISBN missing]}
 Berggren, Lennart; Borwein, Jonathan M.; Borwein, Peter B. (2004). Pi: a source book (3rd ed.). New York: Springer Science + Business Media LLC. ISBN 9781475742176.