Created
January 3, 2013 05:26
-
-
Save kazua/4441052 to your computer and use it in GitHub Desktop.
Project Euler Problem 53
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%2053 | |
| //K.A | |
| object problem53 { | |
| def getPascNum(lc : Int, mc : Int) : BigInt = { | |
| (1 to mc).map(i => (1 until mc).map(j => (BigInt(1) to i).product / ((BigInt(1) to j).product * (BigInt(1) to (i - j)).product)).filter(_ > lc).size).reduceLeft(_ + _) | |
| } | |
| def main(args : Array[String]) { | |
| val mCnt = 100 | |
| val lCnt = 1000000 | |
| println(getPascNum(lCnt, mCnt)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment