Talk:99 questions/Solutions/31

From HaskellWiki
Revision as of 09:29, 14 January 2012 by Ibizaman (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Does something as simple but as dump as this should be on the wiki ?

isPrime :: Int -> Bool
isPrime n | n <= 1 = False
isPrime n = isPrime' 2 n
    where isPrime' x n | x*x > n   = True
                       | otherwise = (n `rem` x) /= 0 && isPrime' (x+1) n