Advertisement
Ladies_Man

Простые числа

Jan 22nd, 2014
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. isPrime :: Int -> Bool
  2.  
  3. isPrime num = primeTest num 2
  4.     where
  5.       primeTest :: Int -> Int -> Bool
  6.       primeTest num x
  7.             | x == num      = True
  8.             | num `mod` x == 0 = False
  9.             | otherwise    = primeTest num (x + 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement