Problem 48 » 履歴 » バージョン 1
Noppi, 2024/01/17 04:06
1 | 1 | Noppi | [ホーム](https://redmine.noppi.jp) - [[Wiki|Project Euler]] |
---|---|---|---|
2 | # [[Problem 48]] |
||
3 | |||
4 | ## Self Powers |
||
5 | The series, $1^1 + 2^2 + 3^3 + \cdots + 10^{10} = 10405071317$. |
||
6 | |||
7 | Find the last ten digits of the series, $1^1 + 2^2 + 3^3 + \cdots + 1000^{1000}$. |
||
8 | |||
9 | ## 自身のべき乗(self powers) |
||
10 | 次の式は, $1^1 + 2^2 + 3^3 + \cdots + 10^{10} = 10405071317$ である. |
||
11 | |||
12 | では, $1^1 + 2^2 + 3^3 + \cdots + 1000^{1000}$ の最後の10桁を求めよ. |
||
13 | |||
14 | ```scheme |
||
15 | (import (scheme base) |
||
16 | (gauche base)) |
||
17 | |||
18 | (define answer-48 |
||
19 | (mod (apply + (map (^n (expt n n)) |
||
20 | (iota 1000 1))) |
||
21 | 10_000_000_000)) |
||
22 | |||
23 | (format #t "48: ~d~%" answer-48) |
||
24 | ``` |