Solution to problem 48

This commit is contained in:
David Doblas Jiménez 2021-09-18 10:00:06 +02:00
parent c1119e7521
commit 6bdb1455c8

28
src/Python/Problem048.py Normal file
View File

@ -0,0 +1,28 @@
#!/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()}")