28 lines
563 B
Python
28 lines
563 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Created on 12 Sep 2021
|
|
|
|
@author: David Doblas Jiménez
|
|
@email: daviddoji@pm.me
|
|
|
|
Solution for problem 48 of Project Euler
|
|
https://projecteuler.net/problem=48
|
|
"""
|
|
|
|
from utils import timeit
|
|
|
|
|
|
@timeit("Problem 48")
|
|
def compute():
|
|
"""
|
|
The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.
|
|
|
|
Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
|
|
"""
|
|
series = sum(i**i for i in range(1,1001))
|
|
return str(series)[-10:]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
print(f"Result for Problem 48: {compute()}") |