#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?
#
nums= Array(1..20)
result=1
while nums.length > 0
a = nums.shift
result *= a
i =0
while j=nums[i]
nums[i] /= a if j % a ==0
i+=1
end
end
puts result
system "pause"
欧拉项目05 ruby版
最新推荐文章于 2022-12-24 13:44:58 发布