Skip to content

Instantly share code, notes, and snippets.

@outsideris
Created May 18, 2013 13:22
Show Gist options
  • Save outsideris/5604380 to your computer and use it in GitHub Desktop.
Save outsideris/5604380 to your computer and use it in GitHub Desktop.
euler problem 6
val size = 100
def sumOfPow(size:Int) = (1 to size).map( math.pow(_, 2) ).sum.toInt
def powOfSum(size:Int) = math.pow((1 to size).sum, 2).toInt
val result = powOfSum(size) - sumOfPow(size)
println(result) // 25164150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment