Skip to content

Commit

Permalink
Find the product of any number.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustin committed Mar 17, 2009
1 parent 4c88d15 commit 038d037
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions haskell/euler/1.hs
Expand Up @@ -7,4 +7,10 @@ multiple_of_3_or_15 :: Integer -> Bool

multiple_of_3_or_15 x = x `mod` 3 == 0 || x `mod` 5 == 0

multiple_of_any :: Integer -> [Integer] -> Bool

multiple_of_any x l = product [ x `mod` n | n <- l ] == 0

euler1 n = sum [ x | x <- [0..n], multiple_of_3_or_15 x]

euler1_b n = sum [ x | x <- [0..n], multiple_of_any x [3, 5]]

0 comments on commit 038d037

Please sign in to comment.