Skip to content

Instantly share code, notes, and snippets.

@kei-q
Created May 11, 2016 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kei-q/d8a1a77a96b250f744e0afcbb0c09dce to your computer and use it in GitHub Desktop.
Save kei-q/d8a1a77a96b250f744e0afcbb0c09dce to your computer and use it in GitHub Desktop.
let rightTriangles = {
(1...10).flatMap { c in
(1...c).flatMap { a in
(1...a).flatMap { b in
(a,b,c)
}
}
}.filter { (a,b,c) in
let b1 = a*a + b*b == c*c
let b2 = a+b+c == 24
return b1 && b2
}
}()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment