The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.
In [1]:
def foo(n, m):
return str(sum((i ** i for i in range(1, n + 1))))[-m:]
In [2]:
foo(10, 10)
Out[2]:
In [3]:
n = 1000
m = 10
%timeit foo(n, m)
foo(n, m)
Out[3]: