Created
July 2, 2015 10:00
-
-
Save hrs113355/3e9913e03e37b96310d1 to your computer and use it in GitHub Desktop.
math summer hw
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
lcm = 1.lcm(2).lcm(3).lcm(4).lcm(6).lcm(7).lcm(8).lcm(9) | |
def check(num) | |
s = num.to_s | |
if s.include? "5" | |
return false | |
end | |
[1,2,3,4,6,7,8,9].each do |i| | |
if ! s.include? i.to_s | |
return false | |
end | |
end | |
true | |
end | |
(1..100000000).each do |i| | |
if check(lcm * i) | |
puts lcm * i | |
break | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment