Skip to content

Instantly share code, notes, and snippets.

@kazua
Created November 23, 2012 12:15
Show Gist options
  • Save kazua/4135361 to your computer and use it in GitHub Desktop.
Save kazua/4135361 to your computer and use it in GitHub Desktop.
Project Euler Problem 48
//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