Comment detail

ダブル完全数 (Nested Flatten)

This comment is reply for 1118 smeghead: loopマクロに慣れてきた。 (ans...(ダブル完全数). Go to thread root.

関数名が嘘でしたorz.訂正します。
1
2
3
4
5
(defun sum-others (n)
  (eql (* n 2) (loop for x from 1 to (1- n) when (zerop (mod n x)) sum x)))

(defun answer ()
  (loop for i from 1 to 1000 when (sum-others i) collect i))
最初ので合ってました。汚してすいません。 おちつけ俺orz.

Index

Feed

Other

Link

Pathtraq

loading...