Jump to Table of Contents Pop Out Sidebar

Problem 48

More details about this document
Create Date:
Publish Date:
Update Date:
2023-11-05 21:35
Creator:
Emacs 29.2 (Org mode 9.6.15)
License:
This work is licensed under CC BY-SA 4.0

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