14 lines
361 B
Haskell
14 lines
361 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 :: (Integral a) => a -> a
|
|
sumPrimes n = sum [ x | x <- [1..n], isPrime(x) ]
|
|
|
|
main = do
|
|
let result = sumPrimes 2000000
|
|
putStrLn $ "Project Euler, Problem 10\n"
|
|
++ "Answer: " ++ (show result)
|