Skip to content

Instantly share code, notes, and snippets.

@ocher
Created January 12, 2010 11:41
Show Gist options
  • Save ocher/275128 to your computer and use it in GitHub Desktop.
Save ocher/275128 to your computer and use it in GitHub Desktop.
(defn calc
([n]
(reduce #(+ %1
(let [x (- (/ (* 20.0 %2) n) 10.0)]
(* (Math/pow Math/E (* x (- x)) ) (/ 20.0 n) ))) 0
(range n))))
(def N 10000)
(def M 5000)
(dotimes [_ 10] (time (println (apply + (map calc (range M))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment