Python Implementation of Problem 48

View source code here on GitHub!

Problem Solution

Project Euler Problem 48

Problem:

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.

python.src.p0048.main() int
 1"""
 2Project Euler Problem 48
 3
 4Problem:
 5
 6The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317.
 7
 8Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
 9"""
10
11
12def main() -> int:
13    ten_ten = 10**10
14    return sum(pow(x, x, ten_ten) for x in range(1, 1001)) % ten_ten

Tags: sequence-summation, power, modular-arithmetic, large-numbers