Skip to content

Instantly share code, notes, and snippets.

@samskivert
Created August 22, 2010 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samskivert/543063 to your computer and use it in GitHub Desktop.
Save samskivert/543063 to your computer and use it in GitHub Desktop.
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