You are viewing a single comment's thread. Return to all comments →
Haskell
import Control.Applicative import Control.Monad import System.IO primes = 2 : [i | i <- [3..], 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 print (primes !! (n-1))
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #7: 10001st prime
You are viewing a single comment's thread. Return to all comments →
Haskell