Given two positive integers N and K. The task is to evaluate the value of 1K + 2 K + 3K + … + NK.
Input: N = 3, K = 4
∑(x4) = 14 + 24 + 34, where 1 ≤ x ≤ N
∑(x4) = 1 + 16 + 81
∑(x4) = 98
Input: N = 8, K = 4
- The idea is to find the value of xK using pow() function. (where x is from 1 to N).
- The required sum is the summation of all values calculated above.
Below is the implementation of the above approach:
Time Complexity: O(N)
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Program to find sum of 1 + x/2! + x^2/3! +...+x^n/(n+1)!
- Program to find the Depreciation of Value
- Program to find sum of the given sequence
- Program to find the sum of the series (1/a + 2/a^2 + 3/a^3 + ... + n/a^n)
- Program to find last two digits of 2^n
- Program to find greater value between a^n and b^n
- Program to find LCM of two numbers
- Program to find sum of series 1 + 1/2 + 1/3 + 1/4 + .. + 1/n
- Program to find LCM of 2 numbers without using GCD
- Program to Find the value of cos(nΘ)
- Program to find HCF iteratively
- Program to find Sum of the series 1*3 + 3*5 + ....
- Program to find GCD or HCF of two numbers
- Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + . . . + n
- Program to find the sum of a Series 1 + 1/2^2 + 1/3^3 + …..+ 1/n^n
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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.