Created
November 17, 2012 06:11
-
-
Save thenickcox/4093744 to your computer and use it in GitHub Desktop.
Project Euler Problem 1 Quick and Dirty
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
multiples = [] | |
(1..999).to_a.each { |x| multiples << x if x % 3 == 0 || x % 5 == 0 } | |
multiples.inject { |x, sum| sum + x } | |
# => 233168 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment