Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created July 29, 2012 17:12
Show Gist options
  • Save rhysd/3200325 to your computer and use it in GitHub Desktop.
Save rhysd/3200325 to your computer and use it in GitHub Desktop.
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