Created
November 23, 2012 02:53
-
-
Save kazua/4133820 to your computer and use it in GitHub Desktop.
Project Euler Problem 16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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