HACKER RANK Project Euler 48 - Self Powers - Solution.'Py'

Project Euler Challenges-48 - Self Powers Solution
Problem Statement
This problem is a programming version of Problem 48 from projecteuler.net
The series,
11+22+33++1010=10405071317

Find the last ten digits of the series,
11+22+33++NN

Note You do not need to print leading zeros. See sample.
Input Format 
Input contains an integer N
Output Format 
Print the answer corresponding to the test case.
Constraints 
1N2×106
Sample Input
10
Sample Output
405071317

Solution:


s = sum(pow(n, n, 10**10) for n in range(1, input()+1))
 
print (s % 10**10)

Thanks for Visiting, Hope this helps you....

Comments

Popular Posts