The series,
Find the last ten digits of the series,
Note You do not need to print leading zeros. See sample.
Input Format
Input contains an integer
Output Format
Print the answer corresponding to the test case.
Constraints
Sample Input
10
Sample Output
405071317
PYTHON IMPLEMENTATION:
L = int(raw_input())
d = 10 # last d digits of series
s = sum(pow(n, n,10**d) for n in range(1, L+1))
print (s% 10**d)
Find the last ten digits of the series,
Note You do not need to print leading zeros. See sample.
Input Format
Input contains an integer
Output Format
Print the answer corresponding to the test case.
Constraints
Sample Input
10
Sample Output
405071317
PYTHON IMPLEMENTATION:
L = int(raw_input())
d = 10 # last d digits of series
s = sum(pow(n, n,10**d) for n in range(1, L+1))
print (s% 10**d)
No comments:
Post a Comment