Skip to content

Instantly share code, notes, and snippets.

@kazua
Created January 9, 2013 14:42
Show Gist options
  • Save kazua/4493629 to your computer and use it in GitHub Desktop.
Save kazua/4493629 to your computer and use it in GitHub Desktop.
Project Euler Problem 26
//http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%2026
//K.A
object problem026 {
def getRecDecMax(mn : Int) : Int = {
val rd = (2 until mn).map(i => (1 until mn).dropWhile(BigInt(10).modPow(_, i) != 1)).map(k => k match { case a if a.isEmpty => 0 case a => a.min })
rd.indexOf(rd.max) + 2
}
def main(args : Array[String]) {
val mn = 1000
println(getRecDecMax(mn))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment