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

8 lines
328 B
Common Lisp
Raw Permalink Normal View History

2013-04-10 16:57:12 -07: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)