Last active
December 10, 2015 14:58
-
-
Save kazua/4451113 to your computer and use it in GitHub Desktop.
Project Euler Problem 56
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%2056 | |
| //K.A | |
| object problem56 { | |
| def getDigSumMax(mc : Int) : Int = { | |
| (1 until mc).map(i => (1 until mc).map(j => (BigInt(i).pow(j)).toString.toList.map(_.toString.toInt).sum)).reduceLeft(_ ++ _).max | |
| } | |
| def main(args : Array[String]) { | |
| val mCnt = 100 | |
| println(getDigSumMax(mCnt)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment