Skip to content

Instantly share code, notes, and snippets.

Created January 9, 2012 18:20
Show Gist options
  • Save anonymous/1584218 to your computer and use it in GitHub Desktop.
Save anonymous/1584218 to your computer and use it in GitHub Desktop.
;; jaskirat's solution to The Big Divide
;; https://4clojure.com/problem/148
(fn [n a b]
(let [e #(quot (- n 1) %)
f #(* % (/ (* (e %) (inc (e %))) 2))
x (f a)
y (f b)
z (f (* a b))]
(- (+ x y) z)))
@alakahakai
Copy link

this solution will get integer overflow. need to use +' and *'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment