Created
May 18, 2013 13:22
-
-
Save outsideris/5604380 to your computer and use it in GitHub Desktop.
euler problem 6
This file contains 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
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