Created
January 21, 2013 13:13
-
-
Save kazua/4585930 to your computer and use it in GitHub Desktop.
Project Euler Problem 55
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%2055 | |
| //K.A | |
| object problem55 { | |
| def bolLychrel(nm : BigInt, acl : Int) : Boolean = nm match { | |
| case a if (a + BigInt(a.toString.reverse)).toString == (a + BigInt(a.toString.reverse)).toString.reverse => false | |
| case a => if (acl < 50) bolLychrel(a + BigInt(a.toString.reverse), acl + 1) else true | |
| } | |
| def problem55 = (1 until 10000).map(i => bolLychrel(i, 0)).filter(_ == true).size | |
| def main(args : Array[String]) { | |
| println(problem55) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment