Created
November 23, 2012 12:15
-
-
Save kazua/4135361 to your computer and use it in GitHub Desktop.
Project Euler Problem 48
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%2048 | |
| //K.A | |
| import scala.math._ | |
| object problem48 { | |
| def getMtpSum(mn : Int) : String = { | |
| (1 to mn).map(i => BigInt(i).pow(i)).reduceLeft(_+_).toString.takeRight(10) | |
| } | |
| def main(args : Array[String]) { | |
| val mn = 1000 | |
| val gps = getMtpSum _ | |
| println(gps(mn)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment