HOME SUMMARY

Problem 48

1. Problem

Self Powers

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).

自幂

自幂级数的前十项求和为 \(1^1+2^2+3^3 +\ldots + 10^{10} = 10405071317\)。

求自幂级数的前一千项求和,即 \(1^1+2^2+3^3 +\ldots + 1000^{1000}\),并给出其最后十个数字作为答案。

2. Solution

在计算过程中不断对 1010 取模即可:

(let ((res 0))
  (cl-loop for i from 1 to 1000
           do (setq res (% (+ res (expt i i)) (expt 10 10))))
  res)
=> 9110846700