(defun is-perfect-number (n) (let ((sum 1)) (loop for i from 2 to (isqrt n) do (when (zerop (mod n i)) (incf sum i) (unless (= i (/ n i)) (incf sum (/ n i))))) (= sum n))) (defun main () (let ((n (read))) (if (is-perfect-number n) (format t "Yes~%") (format t "No~%")))) (main)