Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
10 lines (7 sloc) 161 Bytes
lcm' [] = 0
lcm' ns = lcm_inner ns 1
where
lcm_inner [] r = r
lcm_inner (n:ns) r = lcm_inner ns (r * (n `div` (gcd n r)))
main = do
print $ lcm' [1 .. 20]
Something went wrong with that request. Please try again.