Skip to content

Instantly share code, notes, and snippets.

@olistik
Created January 4, 2011 22:22
Show Gist options
  • Select an option

  • Save olistik/765554 to your computer and use it in GitHub Desktop.

Select an option

Save olistik/765554 to your computer and use it in GitHub Desktop.
the sum of all multiples of 3 and 5 less than 1000
>> (1..1000).select {|x| (x % 3) == 0 && (x % 5) == 0}.inject(:+)
=> 33165
@olistik
Copy link
Author

olistik commented Jan 4, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment