mirror of
https://github.com/correl/elm.git
synced 2024-12-22 19:17:27 +00:00
11 lines
306 B
Text
11 lines
306 B
Text
module SumOfMultiples (..) where
|
|
|
|
|
|
sumOfMultiples : List Int -> Int -> Int
|
|
sumOfMultiples multiples limit =
|
|
List.sum (List.filter (inMultiples multiples) [1..(limit - 1)])
|
|
|
|
|
|
inMultiples : List Int -> Int -> Bool
|
|
inMultiples multiples candidate =
|
|
List.any (\factor -> candidate % factor == 0) multiples
|