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.
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.