|
|
От: | Alex912 | |
| Дата: | 21.12.11 22:07 | ||
| Оценка: | |||
import Data.List
firstPrimes ::Int->[Int]
firstPrimes n= take n $ filter (isPrime) [2..]
count::Int->Int
count n= foldl' (+) 0 (firstPrimes n)
isPrime::Int->Bool
isPrime x = null $ filter (\y -> x `mod` y == 0) $ takeWhile (\y -> y*y <= x) [2..]
main = do
putStrLn $ (show . count) 5000