Skip to content

Instantly share code, notes, and snippets.

@kazua
Created November 23, 2012 02:53
Show Gist options
  • Save kazua/4133820 to your computer and use it in GitHub Desktop.
Save kazua/4133820 to your computer and use it in GitHub Desktop.
Project Euler Problem 16
//http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2016
//K.A
import scala.math._
object problem16 {
def getMtPNum(mp : Int) : String = {
BigInt(2).pow(mp).toString.map(_.asDigit).sum.toString
}
def main(args : Array[String]) {
val mp = 1000
val gsn = getMtPNum _
println(gsn(mp))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment