> The simple continued fraction for pi is given by [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] (OEIS A001203).
> The very large term 292 means that the convergent
> [3;7,15,1]=[3,7,16]=(355)/(113)=3.14159292...
> is an extremely good approximation good to six decimal places that was first discovered by astronomer Tsu Ch'ung-Chih in the fifth century A.D. (Gardner 1966, pp. 91-102).
You can see how the terms in the sequence jump from 1 to 292.
I'm not sure why simple continued fractions are not mentioned here when other continued fractions are not, seems like the author got within a hairs breadth of discovering this connection. I'm not going to say "explanation" because it doesn't explain things, it just connects it to something else.
This isn't really a way that you would calculate pi, but you could compare it with, for example, the continued fraction for e:
[2; 1, 2, 1, 1, 4, 1, 1, 6, ...]
and notice that there is no large numbers here... so there is no fraction for e that is suddenly "very good". Same with sqrt 2 (repeating 2s), same with golden ratio (repeating 1s). In a sense, it's the fact that pi DOESN'T have a neat continued fraction which gives it that nice fractional representation. In a sense, discovering a connection just gives you another question to ask. "Okay, why isn't there a neat little formula for calculating pi as a continued fraction?"
(Look at the tail of the distribution, i.e. sum(p(k)) for k ≥ 292 — that will give the probability that a specific term in the continued fraction of a "random" number is at least 292. This is about 31% I think, so not too surprising.)
Mathologer has a good video in which he uses this to justify calling the golden ratio the "most irrational" number because of this expansion: https://www.youtube.com/watch?v=CaasbfdJdJg The video also goes over the details of the pi expansion.
I decided to try every integer denominator less than 1,000,000 to see how rare this is.
A few fun facts:
Constraining denominators to 4 digits (<10,000) there are NO better fractions than 355/113.
Constraining denominators to 5 digits (<100,000) and excluding multiples (eg. 710/226), 1601 fractions exist which better approximate pi than 355/113.
The best is 312689/99532 which is off by 2.914335439641036e-11
Considering denominators up to 6 digits <1,000,000 and excluding multiples, there are 162,141.
The best is 3126535/995207 which is off by 1.1426415369442111e-12
This was done somewhat subptimally with a potentially buggy implementation in python.
The jump in length from 355/113 to the next one is quite noticeable, and it does not happen with other irrational numbers, such as e, which progress more smoothly:
To process into a rational approximation you want to maintain the two last aproximations a/b, c/d, and to get the first two numbers right you want to start with a/b = 0/1 and c/d = 1/0, zero and infinity.
When you come to a number N in the sequence you form the new rational approximation
(N*c + a)/(N*d + b).
So you absorb 3 to generate 3/1, then you absorb 7 to generate (3×7+1)/(7×1+0)=22/7, then you absorb 15 to generate (15×22 + 3)/(15×7 + 1) = 333/106, then you absorb 1 to get this magical approximation (333 + 22)/(106 + 7) = 355/113, etc.
In a sense what makes it magical is that the next number is very large. The larger it is the more decimal places you get “for free” truncating just before it. That is because this procedure is calculating the continued fraction
3 + 1/(7 + 1/(15 + 1/(1 + ...)))
And you can sort of see that when we fill in the “...” with 0 to truncate the expansion there, that is not so different from truncating it with 1/292 to truncate one step later or 1/293 to truncate two steps later. Those numbers are very close to zero!
That is decimal-based, picking, for any number of digits, the best (according to some criterion) approximation of pi using that number of decimal digits.
They skipped 333/106, for example, because the better approximation 355/113 uses the same number of decimal digits, and included 311/99 because it happens to (just) need 5 decimal digits.
Well, OK, but I specifically wanted decimal fractions. I'm not a mathematician, from my perspective this is just a fun calculator trick. Maybe your calculator has other bases, I'm afraid mine doesn't!
Computing the continued fraction for pi actually presents some technical obstacles though - it has to be done numerically, since there's no known pattern to the sequence, and to do that, it seems like you need to compute higher and higher-precision numerical approximations to pi in order to accurately compute higher terms in the continued fraction expansion.
A more efficient way to search possible fractions close to π is via continued fraction. Then you can have a sequence that has increasing larger denominator where all are approximately π.
Each of the fraction there would be closest to π in the nearby region (nearby in the sense that if you change the size of denominator slightly, and at the same time the numerator accordingly.)
So this is close to what your getting at, just not with exhaustive search and an artificial constraint (say 10000)
Out of interest, do you get the same sort of results for other numbers that look a little like pi (small irrational number)? Or is this something peculiar to pi?
I had to do some more digging on the sequence stated by the author of that post. The idea is to construct a continued fraction, always choosing the next largest denominator you can that doesn’t make the resulting partial evaluation larger than pi.
A comment on the original post brings that exact continued fraction up, the author responds: "the continued fraction sequence 3 7 15... is the continued fraction analogy to the decimal sequence 3 1 4 1 5 9 2... etc: they are both guaranteed-to-exist sequences of successively better approximations for pi that come from the real value of pi. Neither is a way to derive or compute pi if you don't already have the exact value."
So it's not a sequence like the Wallis rational expression or Taylor series approximation, so it's not very helpful in saying "where 355/113 comes from." 355/113 is a good approximation of Pi, and if you engineer your continued fraction to include the best approximation without going over at each step, it will be in there. Doesn't tell you why there's a nice accurate Pi that has such a high "quality" measure.
That is, the 292 showing up in the continued fraction is still (arguably) a surprise, or at least left unexplained.
Yeah, I changed my comment around to try and say that- the question just becomes "huh, why does the big integer 292 show up like that?" which is really the same question as before. Maybe the answer is "that's not actually that surprising", I don't know.
You’re not wrong, I just feel like the way the post was written it was a little bit disingenuous of the author not to at least include the series and discuss it. They make 355/113 seem mysterious, or that it might point to a new series. In fact, it comes from a boring/inevitable series.
Maybe it’s my physics training coming through, but asking “why” pi is close to this cute fraction is the wrong question. I would be much more interested in knowing “given some transcendental number, what is the likelihood that there exists some fraction with at most $x digits that approximates it to $y decimal places?” For instance, 577/408 approximates sqrt(2) even more closely than 355/113. Is this usual? Can I come up with a number between 1 and 10 that has no “good” 3 decimal approximation?
My very basic understanding of measure theory is that it is actually hard to find numbers that are not well approximated by /some/ integer fraction. After all there are a lot of fractions…
>The fraction 355/113 is incredibly close to pi, within a third of a millionth of the exact value. This level of accuracy is far beyond its rights as a fraction with such a small denominator, and it causes various oddities elsewhere in math.
On the other hand, from a purely practical perspective, the answer is only accurate to six digits, which is the number of digits in the fraction you must remember. So, you're not really getting much of a free lunch.
22/7 has you memorize four digits (including the position of the /) to get pi to four digits (including the position of the .), 355/113 has you memorize seven digits to get pi to eight digits, 355/113-1/3748629 has you memorize 17 digits to get pi to 16 digits. I don’t get it. How is it easier than just memorizing pi? How is it surprising to get out about as many bits as you put in?
I agree from the perspective of how most humans could memorize pi. But that's exploiting the fact that humans treat decimal representations as having implicit denominators--3.14 is actually 314/100.
So say you had a computer that didn't treat base 10 as special. Then an apples-to-apples comparison would be that 355/113 (9/7 = 16 binary digits) has the same precision as 3141592/1000000 (22/20 = 40 binary digits). 16 is a lot fewer than 40.
> But that's exploiting the fact that humans treat decimal representations as having implicit denominators
That's to say, we know which base we are using... which is a requirement for writing down numbers in the first place.
>So say you had a computer that didn't treat base 10 as special
Your computer treats base 2 as special. The apples-to-apples comparison would be comparing 355/113 to 11.0010010000111₂ (or a 16-bit float representation of Pi).
355/113 is a better approximation, but not as drastically as you wrote.
Writing in binary, 355/113 = 101100011₂/1110001₂, and the equivalent one is 11.0010010000111111011₂ - hardly that big of a difference.
I was using base 2 just for conveying the numbers of digits, i.e. showing that the digits in representation is related logarithmically to the magnitude of the base-agnostic integers in the fraction. I could have just as easily used natural log or log10 for evaluating the size of those numbers, because the important part is that it's not exploiting the implicit base in your denominator.
I don’t think anyone is impressed by how easy it is to store the symbolic representation of the fraction versus the symbolic representation of the first n digits of pi, or suggesting that it’s a useful way for humans to memorize or calculate pi. What’s notable is simply how close the fraction approximates the irrational number pi given how low the fraction’s denominator is.
22/7 and 355/113 are both special in that the approximation error, relative to the denominator side, is unusually low. Pi is special in that it has even one such small-denominator approximation.
What other example has a similarly low denominator but gives as good or better accuracy than 355/133? I’m under the impression that there aren’t any such examples.
He gave "355/113-1/3748629 has you memorize 17 digits to get pi to 16 digits."
This is a compression problem, a little more breakage here or there is to be expected. If e and every other irrational number showed similar breakage, then I might get interested.
If you're calculating by hand (ie: figuring out material needed for a winding staircase or something) - working with two integers / a ratio can mean you can easily simplify the math, and only deal with narly decimal precision after simplifying.
Eg area of a half circle is:
A = pi * r^2/2
Or, for example, radius 4 units (eg feet):
22 * 4^2
---------
7 * 2
Simplifies to: 88/7. Easy to approximate, easy to work out to needed precision.
You’re right, it’s odd that the article mentions memorization. That’s not what makes this interesting.
Obviously bits is the relevant concept here from a modern information theory perspective. But “digits in fraction” is more interesting. 22/7 vs 314/100. 355/113 vs 3141592/1000000. Of course you don’t need to “remember” the denominator when it is a power of 10. But the error in the approximation is unusually low, compared to the size of the denominator. This is true when comparing to decimal approximations, or other “nearby” rational approximations.
In that sense, these approximations should be “surprising” because they work much better than the decimal ones of similar size (or, much smaller than the decimal approximations of similar accuracy). But they also work better for pi than for many other common irrational numbers.
This is also historically meaningful, as some calculation was done in fractions, e.g. in ancient Egypt. It is an interesting mathematical fact that 22/7 is an approximation to pi that is small enough to be easily discoverable, easy to compute with, and still practically useful.
The easiest way to learn a quite large number of pi digits is with mnemonic poems like this one I've known since I was 10 or so (French):
3 1 4 1 5 9 2 6 5 3 5
Que j'aime à faire apprendre un nombre utile aux sages
8 9 7 9
Immortel Archimède, artiste, ingénieur,
3 2 3 8 4 6 2 6
Qui de ton jugement peut priser la valeur?
4 3 3 8 3 2 7 9
Pour moi ton problème eut de pareils avantages.
Whoa, thanks to your comment, which helpfully illustrates some of the "poetic" aspects of the digits' decimal arrangement, I became instantly convinced the digits of pi are the theme on which Elgar wrote his "Enigma" Variations. It's mentioned on Wikipedia but pretty far down as a recent theory (the source is here[0]). But now I feel almost foolish for not thinking it before.
Quoting Wikipedia, "on the evening of 21 October 1898, after a tiring day's teaching, he sat down at the piano. A melody he played caught the attention of his wife, and he began to improvise variations on it in styles which reflected the character of some of his friends." It's pretty easy to imagine he was just plinking out scale degrees corresponding to the digits of pi in a pleasing rhythm and one thing led to another.
It's amazing that the author never mentioned it was first discovered by Chinese mathematician Zu Chongzhi in 5 century AD: https://en.wikipedia.org/wiki/Mil%C3%BC
I like to imagine this is the universe’s version of a stick with a piece of string on the end and we’re a cat maddeningly entranced by it flitting about.
355/113 is the 4th continued fraction of pi, its 4th best approximation. Transcendent numbers have an interesting property: they are the best approximated by rational numbers, they are the closest to them in a sense; unlike some irrational numbers, such as phi, that are really hard to approximate.
There is a curious hypothesis that the world arranges itself by the continued fraction powers of number e, to avoid destructive resonances that would occur if a rational number was used. In other words, the reason period of electron motion or a planet motion is so close to e^(p/q) because that number is very close to a rational fraction, but isn't rational.
Liouville numbers are numbers which can be "best approximated by rational numbers" in a certain sense.
A number x is a Liouville number if for every integer n>0, there exist integers (p,q) such that 0<|x-p/q|<1/q^n
No algebraic numbers have this property, therefore all of the Liouville numbers are transcendental. However! The reverse is not true; not all transcendental numbers are Liouville. Neither pi nor e are Liouville numbers.
Liouville-ness is a very strict requirement. Instead, we can define "K-liouville numbers, that for all n < K have this property", and then pi is at least a 3-liouville number, which is pretty good.
This is interesting but has no real practical use to us, just something that mathematicians like to talk about and is related to fractions, approximations, convergence and other theorems. I knew about 22/7 but this fraction is more interesting!
It seems to me that an estimation of any computable number would scale with at least but not equal to O(n) of its denominator. Otherwise, it would be non-computable (please correct me, this is just my intuition). For 355/113 to be more than 16x closer to pi than 22/7 would be a matter of course. Furthermore, 1/791 = 1/7 * 1/113, and 355 is the floor of 22 * 7/113, as one might except of a slightly closer approximation. Not to undervalue 355/113. But (personally) intuitively, it's not particularly mysterious.
For irrational numbers, you mean? A rational number is one that can be perfectly represented by a fraction. I'm not sure I follow your use of big-O notation here, but are you saying that the bound of the error of a rational approximation of an irrational number is inversely proportional to the denominator?
You can use Euclid's algorithm [0] to get the continued fraction that produces 355/113. I did a quick search and found a worked example of it here [1].
Same here. When I was a kid in school, we all had those TI-89 calculator that one could program using Basic. When first introduced to Pi and the concept of irrational numbers, I made a script to find close matches. 355/113 was the closest I got with the slow calculator and my (most probably) very slow code.
An interest question is given a random real number x in [0-4] range say, what is the probability there will be a fraction of quality > 3 (for approximating x) for denominators < n.
(restricting n to make the problem easier to say 2048)
Might be a fun programming project (or interview question ha ha) to monte carlo this.
To properly answer this, you'd need a healthy dose of math.
Once you apply all the math, your resulting code is probably relatively simple. But justifying why the simple and short code is justified is a bit more complicated.
A simple example: we have no way to uniformly sample a real number from a range in our computers. Our computers can not represent arbitrary real numbers.
So we need to sample some kind of proxy, and justify that we are getting the same answer as if sampling properly.
Or more formally: we need to estimate the error that our choice of proxy introduces, and justify that estimation.
good to 1e-9? It's easy to say why it's good to 1e-3, a bit more work to show it's 1e-6, and just a little bit more to say why it's 1e-9.
If you know 22/7 and 355/113 then you just subtract them to get another continued fraction for π: (355 - 22)/(113 - 7) = 333/106 ~ pi; that's a bit of a hint.
Coincidences are everywhere and our monkey brains generally have a hard time accepting that they are just coincidences.
One example that will make any physicist bang their head on their desk:
3 * l_P / alpha_em^2 = 9.10543E-31 m
Which is within 4.3E-4 of the numerical value of the electron mass in KG except the formula has units of meters not kilograms so it's complete nonsense.
Averaging two rational approximations whose errors have opposite signs always yields an approximation with lower error and a bigger denominator than either "parent", making good approximations easy to find.
I have a cheap circular slide rule with a bunch of integer fraction approximations for useful constants on the back of it. I guess that would have been just a bit quicker than eyeballing a decimal value.
In the precision world of RF engineering, I approximate pi as "3, and then about a fifth more, and then trim to tune because you can cut it shorter but you can't cut it longer".
For me it's 3.14 first, then it's 3.1415, because 15 is 14+1, then I just memorize 92 and 6. Better than 355/113, which I don't think are that easy to memorize.
Transcendental means a number that is not a root of any polynomial with rational coefficients. The base you count in doesn't affect this definition, those are just different ways of writing down numbers, the numbers themselves don't change. The rational numbers and integers are still the same whatever base you use. 1 is still 1 in any base, there's only one multiplicative identity.
In base pi, 10 (pi) is transcendental. I do get what you're trying to ask, the other reply has a more useful comment.
If the circumference is rational (in "base pi"), then the diameter is also rational, I think.
Suppose the circumference is π, or 10ₚ (base pi). Then the diameter is 1₁₀. What's that in base Pi? Well, how many Pis are in 1? 1/π, or π⁻¹. But in base Pi you write that 0.1ₚ.
Ditto something like π²+π+1 (111ₚ). The diameter is π+1+π⁻¹, or 11.1ₚ.
I love the comments on the page trying to find correlation between 355/113 and the Quran and Bible.
Hmm... well.
jccalhoun 5 minutes ago
'jccalhoun' has 9 characters, and is succeeded by 2 words ('minutes ago'), and 9 times 2 is 18. And 'jccalhoun' is followed by three non-whitespace tokens ('5 minutes ago' and 18 divided by 3 is 6. And 6 repeated three times is 666, so clearly we can conclude ... that numerology is bullshit?
I was reading Unrestricted Warfare, a book published by the PLA in the 90s about their thoughts and strategic considerations re 5th generation warfare. There was a lot of really interesting and insightful stuff in there, periodically interspersed with random Chinese numerology, e.g. how the Union won the American civil war due to an auspicious ratio of men to horses or something.
> The simple continued fraction for pi is given by [3; 7, 15, 1, 292, 1, 1, 1, 2, 1, 3, 1, 14, 2, 1, 1, 2, 2, 2, 2, ...] (OEIS A001203).
> The very large term 292 means that the convergent
> [3;7,15,1]=[3,7,16]=(355)/(113)=3.14159292...
> is an extremely good approximation good to six decimal places that was first discovered by astronomer Tsu Ch'ung-Chih in the fifth century A.D. (Gardner 1966, pp. 91-102).
You can see how the terms in the sequence jump from 1 to 292.
I'm not sure why simple continued fractions are not mentioned here when other continued fractions are not, seems like the author got within a hairs breadth of discovering this connection. I'm not going to say "explanation" because it doesn't explain things, it just connects it to something else.
This isn't really a way that you would calculate pi, but you could compare it with, for example, the continued fraction for e:
[2; 1, 2, 1, 1, 4, 1, 1, 6, ...]
and notice that there is no large numbers here... so there is no fraction for e that is suddenly "very good". Same with sqrt 2 (repeating 2s), same with golden ratio (repeating 1s). In a sense, it's the fact that pi DOESN'T have a neat continued fraction which gives it that nice fractional representation. In a sense, discovering a connection just gives you another question to ask. "Okay, why isn't there a neat little formula for calculating pi as a continued fraction?"