samskivert: Euler 016

17 January 2008

Problem 016:

object Euler16 extends Application {
  println(BigInt(2).pow(1000).toString().foldRight(0) {(a, b) => (b + (a - '0'))});
}

This one almost seemed like cheating, since BigInt takes care of all the hard work for me.

©1999–2022 Michael Bayne