Project Euler Problem 65

694 Views Asked by At

I am working on solving Project Euler problem #65 and run upon the following statement:

What is most surprising is that the important mathematical constant, e = [2; 1,2,1, 1,4,1, 1,6,1 , ... , 1,2k,1, ...].

I don't understand how to interpret this sentence. I also found this on Wiki, which I still don't undestand:

Euler proved that the number e is represented as the infinite simple continued fraction1 enter image description here

Can someone explain this to a non-math major? I'm trying to find a way to turn this pattern into some kind of programming pattern.

2

There are 2 best solutions below

0
On BEST ANSWER

$$\displaystyle \left[ a_1; a_2, \cdots a_n \right] \mapsto a_1 + \frac{1}{a_2 + \frac{1}{a_3 + \frac{1}{\ddots \, + \frac{1}{a_n}}}} $$ So: $$ e = [2; 1,2,1,1,4,1,1,6,1,1,8,1,1,\ldots,2n,1,1,\ldots] \mapsto 2 + \frac{1}{1 + \frac{1}{2+\frac{ 1}{1 + \frac{1}{1+\frac{1}{4 + \frac{1}{\;\ddots}}}}}} $$

0
On

This is a notation for continued fractions, so we can view rational approximations of $e$ in the following way.

$$e = 2$$ $$e = 2 + \frac{1}{1} = 3 $$ $$e = 2 + \frac{1}{1 + \frac{1}{2}} = \frac{8}{3}$$

Notice where the terms of $[2; 1, 2, 1, ...]$ are placed as our approximation converges to $e$.