Skip to content

Instantly share code, notes, and snippets.

@albemuth
Created April 20, 2010 03:38
Show Gist options
  • Save albemuth/371994 to your computer and use it in GitHub Desktop.
Save albemuth/371994 to your computer and use it in GitHub Desktop.
# Problem 5
# What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?
(1...100000000).each do |i|
n = i * 20
(print n; exit) if [19,18,17,16,15,14,13,12,11].inject(true) do |divisible, i|
divisible && (n % i == 0)
end
end
# => 232792560
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment