Skip to content

Commit e957d34

Browse files
committed
DOC redocumenting
1 parent 3de9bfb commit e957d34

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: euler005.hs

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Data.List
33
main = print $ product $ foldl1 lcm_primes $ map prime_factors [1..20]
44

55
lcm_primes :: (Eq a) => [a] -> [a] -> [a]
6-
lcm_primes a b = a ++ (b\\a)
6+
lcm_primes a b = a ++ (b \\ a)
77

88
prime_factors :: (Integral a) => a -> [a]
99
prime_factors 1 = []
@@ -19,4 +19,8 @@ Naive solution: (takes too long and does not scale)
1919
2020
evenlyDivisible1_20 :: (Integral a) => a -> Bool
2121
evenlyDivisible1_20 n = and $ map (== 0) $ map (n `rem`) [1..20]
22+
23+
If, unlike me at the time, you knew that lcm was a built-in function, there is
24+
a one-line solution:
25+
main = print $ foldr1 lcm [1..20]
2226
-}

0 commit comments

Comments
 (0)