fork download
  1. (for ([n (in-port)])
  2. (let ([root (sqrt n)])
  3. (displayln (if (exact? root)
  4. (* root 2)
  5. (for/first ([div (range (exact-floor root) 0 -1)]
  6. #:when (= 0 (remainder n div)))
  7. (+ div (quotient n div)))))))
Success #stdin #stdout 0.3s 58664KB
stdin
7
43
4568
838
3491
2544788
stdout
8
44
579
421
3492
3471