Definition
Strong number is the number that the sum of the factorial of its digits is equal to number itself.For example, 145 is strong, since 1! + 4! + 5! = 1 + 24 + 120 = 145.
Task
Given a number, Find if it is Strong or not and return either "STRONG!!!!" or "Not Strong !!".
; implement
(defn strong [n]
(let [factorial (fn [x]
(if (<= x 1)
1
(apply * (range 1 (inc x)))))
factorial-sum (->> n
str
(map #(Integer/parseInt (str %)))
(map factorial)
(apply +))]
(if (= n factorial-sum)
"STRONG!!!!"
"Not Strong !!")))
; test
; execute implement function
(defn tester [arg exp]
(= (strong arg) exp))
; args & exception
(comment
(tester 1 "STRONG!!!!")
(tester 2 "STRONG!!!!")
(tester 145 "STRONG!!!!")
(tester 40585 "STRONG!!!!")
(tester 7 "Not Strong !!")
(tester 93 "Not Strong !!")
(tester 185 "Not Strong !!"))