プロジェクト

全般

プロフィール

Problem 1 » 履歴 » バージョン 1

Noppi, 2023/12/27 01:29

1 1 Noppi
[ホーム](https://redmine.noppi.jp) - [[Wiki|Project Euler]]
2
# [[Problem 1]]
3
4
```scheme
5
#!r6rs
6
#!chezscheme
7
8
(import (chezscheme))
9
10
(define answer-1
11
  (let loop ((n 3) (sum 0))
12
    (cond
13
      [(<= 1000 n) sum]
14
      [(or (zero? (mod n 3)) (zero? (mod n 5)))
15
       (loop (add1 n) (+ sum n))]
16
      [else (loop (add1 n) sum)])))
17
18
(printf "1: ~D~%" answer-1)
19
```