Skip to content

Instantly share code, notes, and snippets.

@yuuki
Created July 23, 2012 11:21
Show Gist options
  • Save yuuki/3163148 to your computer and use it in GitHub Desktop.
Save yuuki/3163148 to your computer and use it in GitHub Desktop.
euler1
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
puts (1...1000).inject {|sum, n| ((n % 3 == 0) or (n % 5 == 0)) ? sum + n : sum }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment