Skip to content

Instantly share code, notes, and snippets.

@MiSawa
Created August 17, 2012 09:46
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 MiSawa/3377491 to your computer and use it in GitHub Desktop.
Save MiSawa/3377491 to your computer and use it in GitHub Desktop.
require "mathn"
def f(x)
a = []
hash = {}
n = 1/x
while hash[n].nil?
hash[n] = true
n *= 10
n -= n.to_i
end
hash
end
p (1...1000).max_by{|x|f(x).size}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment