Skip to content

Instantly share code, notes, and snippets.

@stuartellis
Created October 31, 2010 23:24
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 stuartellis/657305 to your computer and use it in GitHub Desktop.
Save stuartellis/657305 to your computer and use it in GitHub Desktop.
Possible solution to Euler problem 5
#!/usr/bin/env ruby -wKU
class Application
def test(input)
pass = false
(1..20).each do |number|
if input % number == 0
pass = true
next
else
pass = false
break
end
end
return pass
end
def run
stop = false
candidate = 2520
while !stop
stop = test(candidate)
if !stop
candidate += 20
end
end
candidate
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment