-- 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?
lcmL :: [Int] -> Int
lcmL (x:[]) = x
lcmL (x:xs) = lcm x (lcmL xs)
main = print $ lcmL [1..20]
Project Euler Q5 解法
最新推荐文章于 2017-03-30 18:52:29 发布