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

8 lines
328 B
Common Lisp
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
(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)