RosettaCodeData/Task/Arithmetic-Rational/Common-Lisp/arithmetic-rational.lisp

8 lines
328 B
Common Lisp

(loop for candidate from 2 below (expt 2 19)
for sum = (+ (/ candidate)
(loop for factor from 2 to (isqrt candidate)
when (zerop (mod candidate factor))
sum (+ (/ factor) (/ (floor candidate factor)))))
when (= sum 1)
collect candidate)