Created
July 29, 2012 17:12
-
-
Save rhysd/3200325 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main = print $ filter isPrime [2..] !! 10000 | |
where | |
isPrime n = null $ filter (\x->n `mod` x==0) [2..floor $ sqrt $ fromIntegral n] | |
-- n が素数かどうかを見るには,[2..sqrt(n)] の数が約数に含まれているかを見れば良い. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment