Skip to content

Instantly share code, notes, and snippets.

@ybenjo
Created August 12, 2010 08:11
Show Gist options
  • Save ybenjo/520550 to your computer and use it in GitHub Desktop.
Save ybenjo/520550 to your computer and use it in GitHub Desktop.
def fact(x)
x > 1 ? x * fact(x-1) : 1
end
def f(x)
return fact(x).to_s.reverse.scan(/^0+/).to_s.size
end
if $0 == __FILE__
p f(ARGV[0].to_i)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment