Created
October 31, 2010 23:24
-
-
Save stuartellis/657305 to your computer and use it in GitHub Desktop.
Possible solution to Euler problem 5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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