14 lines
346 B
Haskell

-- The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
--
-- Find the sum of all the primes below two million.
import ProjectEuler (isPrime)
sumPrimes :: Int -> Int
sumPrimes n = sum [ x | x <- [1..n], isPrime x ]
main = do
let result = sumPrimes 2000000
putStrLn $ "Project Euler, Problem 10\n"
++ "Answer: " ++ show result