Skip to content

Instantly share code, notes, and snippets.

@thenickcox
Created November 17, 2012 06:11
Show Gist options
  • Save thenickcox/4093744 to your computer and use it in GitHub Desktop.
Save thenickcox/4093744 to your computer and use it in GitHub Desktop.
Project Euler Problem 1 Quick and Dirty
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