projects
/
sandbox
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Implemented tuple serialization
[sandbox]
/
euler
/
clj
/
21.clj
1
(defn factors [n]
2
(filter #(zero? (mod n %))
3
(take (- n 1) (iterate inc 1))))
4
5
(defn d [n]
6
(reduce + (factors n)))
7
8
(defn amicable? [a b]
9
(and
10
(= a (d b))
11
(= (d a) b)))
12
13
(defn list-length [a]
14
(if (= (first a) nil)
15
0
16
(+ 1 (list-length (rest a)))))