Skip to content

Instantly share code, notes, and snippets.

@onlyshk
Created May 13, 2012 14:33
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 onlyshk/2688700 to your computer and use it in GitHub Desktop.
Save onlyshk/2688700 to your computer and use it in GitHub Desktop.
package proj_euler
object Problem9 {
def solve() : Long = {
var b = Range(1,500)
var c = 3
for (i <- b){
var a = (500000 - (1000 * i))/(1000-i)
if (Math.floor(a) == a) {
var c = 1000 - a - i
if (a*a + i*i == c*c)
return a * i * c
}
}
return 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment