Problem #48 Difficulty: 5%

Self Powers

Solution Language: Python

Problem Statement

The series, 1¹ + 2² + 3³ + … + 10¹⁰ = 10405071317.

Find the last ten digits of the series, 1¹ + 2² + 3³ + … + 1000¹⁰⁰⁰.

Approach

The solution involves:

  1. Computing each self power (n^n) modulo 10^10
  2. Using modular arithmetic to keep only the last 10 digits
  3. Summing all terms with modular reduction
  4. Avoiding overflow by using BigInteger or careful modular exponentiation