samskivert: Euler 006

09 January 2008

Problem 006:

object Euler6 extends Application {
  val first100sum = List.range(1,101).foldLeft(0)(_+_);
  val first100sumsq = List.range(1,101).foldLeft(0)((b, a) => (b + a*a));
  println(first100sum * first100sum - first100sumsq);
}

©1999–2022 Michael Bayne