From 6bdb1455c850628807cc9fc8900b87c05ddfd1f0 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Sat, 18 Sep 2021 10:00:06 +0200 Subject: [PATCH] Solution to problem 48 --- src/Python/Problem048.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/Python/Problem048.py diff --git a/src/Python/Problem048.py b/src/Python/Problem048.py new file mode 100644 index 0000000..19ca3d2 --- /dev/null +++ b/src/Python/Problem048.py @@ -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()}") \ No newline at end of file