
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Python Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
In this article, we will learn about the solution and approach to solve the given problem statement.
Problem statement −Given an integer input n, we need to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
Here we are implementing for loop, therefore, we get O(n) as the time complexity.
Here to reach the efficiency we calculate factorial within the same loop.
Here we frame a sumofseries function as described below −
Example
def sumOfSeries(num): res = 0 fact = 1 for i in range(1, num+1): fact *= i res = res + (i/ fact) return res n = 100 print("Sum: ", sumOfSeries(n))
Output
Sum: 2.7182818284590455
All variables and functions are declared in global scope as shown in the figure below.
Conclusion
In this article, we learned about the approach to find whether it is possible to make a divisible by 3 numbers using all digits in an array.
- Related Articles
- C++ Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! + …… n/n!
- Java Program to find the sum of a Series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
- C++ program to find the sum of the series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
- C++ program to find the sum of the series (1*1) + (2*2) + (3*3) + (4*4) + (5*5) + … + (n*n)
- Sum of the series 1 + (1+2) + (1+2+3) + (1+2+3+4) + ... + (1+2+3+4+...+n) in C++
- Program to find Sum of a Series a^1/1! + a^2/2! + a^3/3! + a^4/4! +…….+ a^n/n! in C++
- Sum of the Series 1/(1*2) + 1/(2*3) + 1/(3*4) + 1/(4*5) + ... in C++\n
- Program to find sum of series 1 + 1/2 + 1/3 + 1/4 + .. + 1/n in C++
- C++ program to find the sum of the series 1 + 1/2^2 + 1/3^3 + …..+ 1/n^n
- Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + .. + n in C++
- Find Sum of Series 1^2 - 2^2 + 3^2 - 4^2 ... upto n terms in C++
- C++ program to find the sum of the series (1/a + 2/a^2 + 3/a^3 + … + n/a^n)
- C++ Programe to find n-th term in series 1 2 2 3 3 3 4
- Sum of the series 1^1 + 2^2 + 3^3 + ... + n^n using recursion in C++
- Find the sum:\( 4-\frac{1}{n}+4-\frac{2}{n}+4-\frac{3}{n}+\ldots \) upto \( n \) terms

Advertisements