The Mystery of 355/113 (2010)
davidbau.com
davidbau.com
> 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?"
• Gauss-Kuzmin distribution: https://en.wikipedia.org/w/index.php?title=Gauss%E2%80%93Kuz...
• This post: https://11011110.github.io/blog/2022/06/04/maybe-powers-pi.h...
(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.)
The fourth comment raises this and the author addresses it in the fifth.
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.
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.
It's in a gist here: https://gist.github.com/thecadams/df3e12571294e3f7a9f5c07e91...
3/1 = 3.0
22/7 = 3.142857142857143
311/99 = 3.1414141414141414
355/113 = 3.1415929203539825
99733/31746 = 3.1415926415926414
312689/99532 = 3.1415926536189365
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: 8/3 = 2.6666666666666665
19/7 = 2.7142857142857144
87/32 = 2.71875
193/71 = 2.7183098591549295
878/323 = 2.718266253869969
1457/536 = 2.718283582089552
2721/1001 = 2.7182817182817183
25946/9545 = 2.7182818229439496
49171/18089 = 2.718281828735696
271801/99990 = 2.7182818281828185https://shreevatsa.wordpress.com/2011/01/10/not-all-best-rat...
Why would the base you write the numbers down in affect whether a rational number is considered “best so far”?
In brief, π can be represented as a stream of integers,
[ 3, 7, 15, 1, 292,
1, 1, 1, 2, 1, 3,
1, 14, 2, 1, 1,
2, 2, 2, 2, 1,
84, 2, 1, 1, 15, 3,
13, 1, 4, 2, 6,
6, 99, 1, 2, 2,
6, 3, 5, 1, 1, 6,
8, 1, 7, 1, 2,
3, 7, 1, 2, 1,
1, 12, 1, 1, 1, 3,
1, 1, 8, 1, 1,
2, 1, 6, 1, 1,
5, 2, 2, 3, 1, 2,
4, 4, 16, 1, 161, ...]
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!The OP did not have the sequence of best rational approximations derived from the continued fraction, but
3/1 = 3.0
22/7 = 3.142857142857143
311/99 = 3.1414141414141414
355/113 = 3.1415929203539825
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.
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.
Turns out there is another way: https://math.stackexchange.com/a/720082/
https://gist.github.com/akovaski/ce7a4230ed2ea0275f70e33c77e...
see also: https://qin.laya.com/tech_projects_approxpi.html https://math.stackexchange.com/questions/1462062/is-there-a-...
Well by the author, maybe. [1]
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.
[1] https://www.quora.com/Why-is-355-113-so-close-to-pi/answer/T...
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.
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…
It might! Just because it's in the boring series, doesn't mean there might not be a new series that it's in.
... unless it does?
What about the sequence where the denominator starts at 113 and keeps doubling, the numerator each time being the one giving the least error.
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.
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.
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.
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.
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 can't 'just' memorize pi. You have to pick a number system first.
And yes, if you work a lot with decimal numbers, then memorising an approximation for pi in that system will come comparatively easy.
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.
Edit: changed 7 to 8, my mistake
The Mystery of 355/113 - https://news.ycombinator.com/item?id=4285531 - July 2012 (65 comments)
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.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.
[0]https://academiccommons.columbia.edu/doi/10.7916/D8377M82/do...
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.
https://mathworld.wolfram.com/IrrationalityMeasure.html
I don't think the value for pi is known. The value for e is 2, which is the same value for e.g. sqrt 2.
Sounds intriguing. Do you have any references off the top of your head, or at least some keywords that I can google to learn more?
Hey, thank you. That is obvious upon hearing, and makes perfect intuitive sense, but I might never have thought of it.
If NASA is using 15 digits of pi for their calculations ( https://www.jpl.nasa.gov/edu/news/2016/3/16/how-many-decimal... ), I’m more than happy with the 11 digits I’ve memorized :-)
[0]: https://en.wikipedia.org/wiki/Euclidean_algorithm#Continued_...
Suppose x is irrational and p/q is a rational in lowest terms with q > 0, and
|x - p/q| < 1/(2 q^2).
Then p/q is a convergent in the continued fraction expansion for x.Using this, you can show that 355/113 is the best rational approximation to pi with denominator less than 1000. (Assume that there's a better approximation, and use the result to get a contradiction.) I wrote this up in my number theory notes (https://sites.millersville.edu/bikenaga/number-theory/approx... and https://sites.millersville.edu/bikenaga/number-theory/approx... [pdf]).
I used an electronic calculator, so I had some superhuman help, and I discovered it several centuries after it was truly discovered.
But this is still a good memory for me, and for this reason I remember the ratio 355/113 better than I remember 22/7.
(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.
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.
sin(333) + sin(355) = sin(22) [angles in radians]
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.
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.
l_P = Planck length
alpha_em = "fine structure constant"22/7 = 3 1/7 ==> 355/113 = 3 1/(7 + 1/16)
This means just memorizing 3 numbers. {3,7,16} and continued fraction format.
Recall phi=(5^.5+1)/2, and phi²=phi+1.
In base pi, 10 (pi) is transcendental. I do get what you're trying to ask, the other reply has a more useful comment.
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ₚ.
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?
Or 'jccalhouun' is actually SATAN?!?? Hmmm...
[1] https://lcamtuf.coredump.cx/evilfinder/ef.cgi?said=jccalhoun