Skip to content

Instantly share code, notes, and snippets.

@daiksy
Created November 21, 2012 04:49
Show Gist options
  • Save daiksy/4123072 to your computer and use it in GitHub Desktop.
Save daiksy/4123072 to your computer and use it in GitHub Desktop.
Project Euler Problem 6
/**
* http://projecteuler.net/problem=6
* http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%206
*/
val xs = 1 to 100
import scala.math.pow
val ret = pow(xs.sum, 2).toInt - xs.map(pow(_, 2)).sum.toInt
println(ret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment