You are viewing a single comment's thread. Return to all comments →
Haskell
import Control.Applicative import Control.Monad import System.IO import Data.List primes = 2 : [i | i <- [3..1000000], and [rem i p > 0 | p <- takeWhile (\p -> p^2 <= i) primes]] main :: IO () main = do t_temp <- getLine let t = read t_temp :: Int forM_ [1..t] $ \a0 -> do n_temp <- getLine let n = read n_temp :: Int let primesToInput = filter (<= n) primes print (sum primesToInput)
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #10: Summation of primes
You are viewing a single comment's thread. Return to all comments →
Haskell