Created
December 1, 2013 08:38
-
-
Save kaosf/7729930 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; https://codeiq.jp/magazine/2013/11/2764/ | |
| (def inf-fib | |
| (map (fn [x] (x 1)) | |
| (iterate | |
| (fn [[a b]] [b (+ a b)]) | |
| [1 2]))) | |
| (defn sum-of-dec-string [s] | |
| (reduce + | |
| (map | |
| (fn [c] (Integer. (str c))) | |
| s))) | |
| (defn can-devide [x] | |
| (= | |
| (mod x (sum-of-dec-string (str x))) | |
| 0)) | |
| (take 11 (filter can-devide inf-fib)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment