Open In App

Python Program for Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +.......+ n/n!

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

You have been given a series 1/1! + 2/2! + 3/3! + 4/4! +.......+ n/n!, find out the sum of the series till nth term. Examples:

Input :n = 5
Output : 2.70833

Input :n = 7
Output : 2.71806
Python3
# Python code to find smallest K-digit  
# number divisible by X

def sumOfSeries(num):
    
    # Computing MAX
    res = 0
    fact = 1
    
    for i in range(1, num+1):
        fact *= i
        res = res + (i/ fact)
        
    return res
    

n = 5
print("Sum: ", sumOfSeries(n))

# Code contributed by Mohit Gupta_OMG <(0_o)>

Output:

Sum: 2.70833

Time Complexity: O(N)

Auxiliary Space: O(1)

Please refer complete article on Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +.......+ n/n! for more details!


Article Tags :
Practice Tags :

Similar Reads