操作
Problem 3 » 履歴 » リビジョン 2
« 前 |
リビジョン 2/4
(差分)
| 次 »
Noppi, 2023/12/27 04:44
Problem 3¶
#!r6rs
#!chezscheme
(import (chezscheme))
(define answer-3
(let* ([n 600851475143]
[check-max (isqrt n)])
(let loop ([current 3] [rest n] [max-prime 1])
(cond
[(< check-max current) max-prime]
[(zero? (mod rest current))
(loop current (div rest current) current)]
[else (loop (+ current 2) rest max-prime)]))))
(printf "3: ~D~%" answer-3)
Noppi が2023/12/27に更新 · 2件の履歴