Skip to content
Browse files

added problem 5 solution

  • Loading branch information...
1 parent 128ec62 commit 44c7c024f2fee31b3f29ce5d6a1cabcd7b0cd79a @ecamacho committed Jan 28, 2012
Showing with 22 additions and 0 deletions.
  1. +22 −0 problem5.rb
View
22 problem5.rb
@@ -0,0 +1,22 @@
+
+def smallest_evenly_divisible
+ start = 20
+ counter = 2
+ found = false
+ until found do
+ puts start
+ puts counter
+ evenly_divisible = true
+ for i in [20, 19, 18, 17, 16, 15, 14, 13, 12, 11]
+ evenly_divisible &= (start % i == 0)
+ end
+ found = evenly_divisible
+ if !found then
+ start *= counter
+ counter += 2
+ end
+ end
+ start
+end
+
+puts smallest_evenly_divisible

0 comments on commit 44c7c02

Please sign in to comment.
Something went wrong with that request. Please try again.