I was working on a post about Archimedes calculation for pi, and I saw a reference that said Ptolemy used 377/120 as a rational approximation to the value.

And then I also read that 355/113 is an even better approximation, and it is credited to the Chinese mathematician Zu Chongzhi (5th century CE).

There is a whole article in wikipedia about this subject. Recall that Archimedes established upper and lower bounds on pi of 22/7 (3.14285714) and 3-10/71 (3.14084507)

In decimal form, Ptolemy's value is

377/120 = 3.14166...

This is correct to the third digit after the decimal point. The error is 7401 parts in ten million. And really, it is accurate enough for any practical work.

I found it curious that the other value has a smaller denominator, but was not found by Ptolemy, and yet it is better, much better.

355/113 = 3.14159292

This is correct to the sixth digit after the decimal point. The error is 27 parts in ten million. That's about 275 times better than Ptolemy's value.

There is some text from Pi: A Source Book, by Berggren et al online. In a chapter by Tam Lay-Young and And Tian-Se, I found a calculation ascribed to Liu Hui (3rd century CE).

The calculation does not seem to be any kind of a technical breakthrough, it is just a basic usage of the Pythagorean theorem. (However, there are some values given that I don't see where they came from, so maybe I'm missing something).

Start with a circle of radius 10, and inscribe a hexagon. One of the six equilateral triangles is shown.

DC = 5.17638.

Repeat until you're satisfied. Keep track of n, the total number of sides.At the end, compute the area of the polygon as 1/2 times the radius times n times the chord. Since r = 10, the area of the circle is pi times 100.

The estimate based on the dodecagon is 6 x 10 x 5.17638 divided by 100 = 3.10582854.

In the end, they obtain 314-64/625, 314-169/625 as the bounds on pi (it's not clear to me how an upper bound was obtained).

In decimal, this means that 3.141024 < pi < 3.142704, which is slightly better than Archimedes.

Apparently, Zu Chongzhi (5th century CE) went farther, far enough to recognize that 355/113 matches an improved estimate very well.

The wikipedia article on Zu Chongzhi claims that he is "most notable for calculating pi as between 3.1415926 and 3.1415927". It claims that his works show he calculated pi to 6 digits using a "12,288-gon".

That's obtained by doubling a hexagon 9 times. Using Python the other day, we obtained the sixth digit (after the decimal point) on round 9 of hexagon doubling as well.

The answer as to how Ptolemy missed it seems to be that he didn't know the true value of pi well enough to believe that 355/113 was any better than 377/120. The other possibility is that he was led to his value by some logic, and didn't check nearby values systematically.

I wrote a Python program to find rational approximations to (irrational) numbers. The gist is here.

355/113 is a spectacular success.

No other value comes close for a long time. Aside from 355/113, every other fraction that becomes a better approximation is a very gradual improvement on what came before. The first fraction to be a better approximation for pi than 355/113 is 52163/16604.

A Dedekind cut has to land somewhere. I suppose 355/113 just lands particularly close to pi by accident.

Here is a plot of the errors. The x-axis is the denominator. The log of the absolute value of the difference from pi is plotted for all fractions that are closest to pi for a given denominator and also in lowest terms. (gist). You can see how special 355/113 is, and it stays that way (not shown).

I've written up the math for the area and perimeter methods for estimating pi and compared it to Archimedes (here).