Skip to content

Instantly share code, notes, and snippets.

@thieux
Last active May 24, 2017 17:52
Show Gist options
  • Save thieux/c1554fdbd0605487ed3c5649482f60a6 to your computer and use it in GitHub Desktop.
Save thieux/c1554fdbd0605487ed3c5649482f60a6 to your computer and use it in GitHub Desktop.
A brute force approach to the pythagorean triples problem in Clojure
(let [max 100]
(take 100
(for [a (range 1 max)
b (range 1 max)
c (range 1 max)
:when (= (+ (* a a) (* b b)) (* c c))]
[a b c])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment