Permalink
Browse files

Reimplementing classify in terms of factors-less-than-number. EOM

  • Loading branch information...
Tim Visher
Tim Visher committed Mar 12, 2012
1 parent e90e920 commit c85daeb9cbb05e8f478c7d90db2710e259af438a
Showing with 2 additions and 2 deletions.
  1. +2 −2 ft1/functional-number-classifier/src/functional_number_classifier/core.clj
@@ -14,6 +14,6 @@
(filter (partial > number) (factors number)))
(defn classify [number]
- (cond (= 6 number) :perfect
- (= 2 number) :deficient
+ (cond (= (reduce + (factors-less-than-number number)) number) :perfect
+ (< (reduce + (factors-less-than-number number)) number) :deficient
:default :abundant))

0 comments on commit c85daeb

Please sign in to comment.