プロジェクト

全般

プロフィール

Problem 1 » 履歴 » リビジョン 2

リビジョン 1 (Noppi, 2023/12/27 01:29) → リビジョン 2/4 (Noppi, 2023/12/27 04:43)

[ホーム](https://redmine.noppi.jp) - [[Wiki|Project Euler]] 
 # [[Problem 1]] 

 ```scheme 
 #!r6rs 
 #!chezscheme 

 (import (chezscheme)) 

 (define answer-1 
   (let loop ([n 3] [sum 0]) ((n 3) (sum 0)) 
     (cond 
       [(<= 1000 n) sum] 
       [(or 
          (zero? (mod n 3)) 
          (zero? (mod n 5))) 
        (loop (add1 n) (+ sum n))] 
       [else (loop (add1 n) sum)]))) 

 (printf "1: ~D~%" answer-1) 
 ```