Skip to content

Instantly share code, notes, and snippets.

@paul-english
Last active December 31, 2015 05:19
Show Gist options
  • Save paul-english/7939988 to your computer and use it in GitHub Desktop.
Save paul-english/7939988 to your computer and use it in GitHub Desktop.
Calculating for fools gold
(defn argmax [f coll] (reduce (fn [a b] (if (> (f a) (f b)) a b)) coll))
(defn fools-constant [C N]
(let [n (argmax #(mod % 1)
(for [n (range 1 N)] (* C n)))]
[n (/ n C)]))
(fools-constant Math/PI 100)
(fools-constant Math/E 100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment