Skip to content

Instantly share code, notes, and snippets.

@kazua
Last active December 10, 2015 14:58
Show Gist options
  • Save kazua/4451113 to your computer and use it in GitHub Desktop.
Save kazua/4451113 to your computer and use it in GitHub Desktop.
Project Euler Problem 56
//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