Self powers

The series, 11 + 22 + 33 + ... + 1010 = 10405071317.

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


Idea

Naive solution.

But I wonder if there is any clever solution, since in other programming languages, high-order power might exceed integer limit.


In [1]:
def solve(bound, last_digits_number):
    s = sum(map(lambda i: pow(i, i), range(1, bound+1)))
    return s % pow(10, last_digits_number)
In [2]:
solve(10, 10)
Out[2]:
405071317
In [3]:
solve(100, 10)
Out[3]:
9027641920
In [4]:
solve(1000, 10)
Out[4]:
9110846700