not yet working

This commit is contained in:
piks3l 2017-08-01 23:31:06 +02:00
parent 2971d84187
commit 23ec825990

20
ruby_algo/ex5.rb Normal file
View file

@ -0,0 +1,20 @@
# 2520 is the smallest number that can be divided by each
# of the numbers from 1 to 10 without any remainder.
# What is the smallest positive number that is evenly
# divisible by all of the numbers from 1 to 20?
x = 1
n = 10
a = (1..n)
class Integer
def factors() (1..self).select { |n| (self % n).zero? } end
end
puts x.factors
unless x.to_a.length == 10
x +=1
x.factors
end