Problem 5 » 履歴 » バージョン 2
Noppi, 2023/12/27 04:46
1 | 1 | Noppi | [ホーム](https://redmine.noppi.jp) - [[Wiki|Project Euler]] |
---|---|---|---|
2 | # [[Problem 5]] |
||
3 | |||
4 | ```scheme |
||
5 | #!r6rs |
||
6 | #!chezscheme |
||
7 | |||
8 | (import (chezscheme)) |
||
9 | |||
10 | (define answer-5 |
||
11 | 2 | Noppi | (let ([n (* 11 13 15 16 17 19)]) |
12 | (let loop ([i n]) |
||
13 | 1 | Noppi | (if (and |
14 | (zero? (mod i 12)) |
||
15 | (zero? (mod i 14)) |
||
16 | (zero? (mod i 18)) |
||
17 | (zero? (mod i 20))) |
||
18 | i |
||
19 | (loop (+ i n)))))) |
||
20 | |||
21 | (printf "5: ~D~%" answer-5) |
||
22 | ``` |