Skip to content

Instantly share code, notes, and snippets.

@ypsilon-takai
Created November 17, 2011 10:10
Show Gist options
  • Select an option

  • Save ypsilon-takai/1372842 to your computer and use it in GitHub Desktop.

Select an option

Save ypsilon-takai/1372842 to your computer and use it in GitHub Desktop.
project euler 63
;; Problem 63 : 2011/11/17
;; "Elapsed time: 1.326705 msecs"
(require '[clojure.contrib.math :as math])
(defn digits-of-pow [x n]
(count (str (math/expt x n))))
(defn pe63 []
(for [x (range 1 10)]
(count
(take-while #(= (first %) (last %))
(map #(vector % (digits-of-pow x %)) (iterate inc 1))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment