Created
August 22, 2010 00:06
-
-
Save samskivert/543063 to your computer and use it in GitHub Desktop.
This file contains 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
object Euler063 extends EulerApp { | |
def count (n :Int, p :Int, c :Int) :Int = | |
if (n == 10) c | |
else if (BigInt(n).pow(p).toString.length < p) count(n+1, 1, c) | |
else count(n, p+1, c+1) | |
def answer = count(1, 1, 0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment