Skip to content

Instantly share code, notes, and snippets.

@kaosf
Created December 1, 2013 08:38
Show Gist options
  • Select an option

  • Save kaosf/7729930 to your computer and use it in GitHub Desktop.

Select an option

Save kaosf/7729930 to your computer and use it in GitHub Desktop.
; 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