Created
October 8, 2009 02:29
-
-
Save eric1234/204649 to your computer and use it in GitHub Desktop.
Problem 5 on Project Euler
This file contains hidden or 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
| class Numeric | |
| def divisible_by? num | |
| self % num == 0 | |
| end | |
| end | |
| possible = increment = 20 * 19 | |
| test = (11..18).to_a.reverse | |
| loop do | |
| if test.all? {|d| possible.divisible_by? d} | |
| puts possible | |
| exit | |
| end | |
| possible += increment | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment