The number e is a famous irrational number called Euler’s number after Leonhard Euler a Swiss Mathematician (1707 – 1783). Number e is considered to be one of the most important numbers in mathematics.
The first few digits are: 2.7182818284590452353602874713527… It has an infinite number of digits with no recurring pattern. It cannot be written as a simple fraction.
Number e is the limit of (1 + 1/n)n as n approaches infinity:
Number e is a mathematical constant that is the base of the natural logarithm: the unique number whose natural logarithm is equal to one. Find out more on https://en.wikipedia.org/wiki/E_(mathematical_constant).
In this challenge we will use a Python script to calculate an approximation of e using two different approaches:
- An iterative approach
- A recursive approach
Calculating e using an iterative approach
Euler’s number, e, can also be calculated as the sum of the infinite series:
Complete your Python script to implement this infinite series using an iterative approach. (Method 2)
Calculating e using a recursive approach
A less common approach to calculate number e is to use a continued fraction based on the following sequence:
Complete your Python script to implement this continued fraction. (Method 3)
This continued fraction for e converges three times as quickly:
This continued fraction for e converges three times as quickly.
Complete your Python script to implement this continued fraction. (Method 4)