Skip to content

Instantly share code, notes, and snippets.

@kristenmills
Created May 20, 2013 15:12
Show Gist options
  • Save kristenmills/5612858 to your computer and use it in GitHub Desktop.
Save kristenmills/5612858 to your computer and use it in GitHub Desktop.
LOG1 = Math.log(GOLDEN_RATIO, 10)
LOG2 = Math.log(Math.sqrt(5), 10)
def problem104
n = 2
fn1 =1
fn2 = 1
while true
n += 1
fn = (fn1 + fn2) % 10**9
fn2 = fn1
fn1 = fn
if pandigital?(fn)
val = n*LOG1 - LOG2
if pandigital?((10**(val - val.floor + 8)).floor)
break
end
end
end
n
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment