Problem: Write a Python program to find the sum of the series [1/1! + 1/2! + 1/3! +-+ 1/n!].


We can easily find the sum of this series using loop, list comprehension, and function in Python.

Using the for loop and list comprehension, we store the value of each term (i.e. 1/i!) into a list and add them all using the inbuilt sum() method in Python.


Enter value of n: 50

To find the factorial of every denominator of the series, we use the factorial() method which we have defined at the starting of the program.

We can significantly improve the efficiency of the program by running loops in the reverse direction and using dynamic programming to find the factorial of the number.

Leave a Reply

16 + 20 =