ST
(defn armstrong? [num] )и вперед
Size: a a a
ST
(defn armstrong? [num] )и вперед
СС
ST
exp (count (str num))
?СС
СС
СС
СС
ST
СС
СС
СС
СС
ST
ST
ST
СС
СС
ST
(defn exponents
[n]
(into {}
(map (juxt (comp first str) #(.pow (biginteger %) n)))
(range 10)))
(defn armstrong?
[x]
(let [s (str x)
n (count s)
x' (transduce (map (exponents n)) + s)]
(= x x')))
ST
(armstrong? 115132219018763992565095597973971522401)
=> true
(criterium/quick-bench
(armstrong? 115132219018763992565095597973971522401))
Evaluation count : 46902 in 6 samples of 7817 calls.
Execution time mean : 13,132000 µs
Execution time std-deviation : 410,042927 ns
Execution time lower quantile : 12,702894 µs ( 2,5%)
Execution time upper quantile : 13,668062 µs (97,5%)
Overhead used : 1,800560 ns
=> nil
СС