Created
January 20, 2013 04:13
-
-
Save kazua/4576626 to your computer and use it in GitHub Desktop.
Project Euler Problem 39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2039 | |
| //K.A | |
| object problem39 { | |
| def problem39 = (3 to 1000).map(i => for (b <- 2 until i; a <- 1 until b; c = i - a - b if a * a + b * b == c * c && c > 0) yield List(i, a, b, c)).filter(_ != Nil).map(n => List(n.head.head, n.size)).sortBy(s => s.last).last.head | |
| def main(args : Array[String]) { | |
| println(problem39) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment