The program is to find a mathematical series, where we need to accept the value of n and m. n is the base number and m is the number of times till which the series run.
Input : 2 + 22 + 222 + 2222 + 22222 Output : 24690 Input : 12 + 1212 + 121212 Output : 122436
We first convert the numbers into string format and concatenate them regularly. Later, we convert them back to integer and add them upto mth term. as shown in the following program.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Use Pandas to Calculate Statistics in Python
- Python | Calculate geographic coordinates of places using google geocoding API
- Python program to calculate age in year
- Python | Pandas Series.mad() to calculate Mean Absolute Deviation of a Series
- Python | Calculate difference between adjacent elements in given list
- Python | Calculate Distance between two places using Geopy
- Python | Calculate City Block Distance
- Calculate the average, variance and standard deviation in Python using NumPy
- How to calculate dot product of two vectors in Python?
- Python - Calculate the percentage of positive elements of the list
- Calculate distance and duration between two places using google distance matrix API in Python
- Calculate standard deviation of a dictionary in Python
- Calculate pooled standard deviation in Python
- Python program to calculate the number of words and characters in the string
- Calculate standard deviation of a Matrix in Python
- Python program to calculate gross pay
- Python program to calculate the number of digits and letters in a string
- Python | Find the Number Occurring Odd Number of Times using Lambda expression and reduce function
- Python | Add similar value multiple times in list
- Python | Check if k occurs atleast n times in a list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet