Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,8 +1,9 @@
|
|||
(defn proper-divisors [n]
|
||||
(if (< n 4)
|
||||
'(1)
|
||||
(cons 1 (filter #(zero? (rem n %)) (range 2 (inc (quot n 2))))))
|
||||
)
|
||||
[1]
|
||||
(->> (range 2 (inc (quot n 2)))
|
||||
(filter #(zero? (rem n %)))
|
||||
(cons 1))))
|
||||
|
||||
(defn perfect? [n]
|
||||
(== (reduce + (proper-divisors n)) n)
|
||||
)
|
||||
(= (reduce + (proper-divisors n)) n))
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
(defn perfect? [n]
|
||||
(= n (reduce + (for [i (range 1 n) :when (= 0 (mod n i))] i))))
|
||||
(->> (for [i (range 1 n)] :when (zero? (rem n i))] i)
|
||||
(reduce +)
|
||||
(= n)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue