At the risk of doing someone's homework...
A naive solution is to do trial division by all integers from 2 up to sqrt
n.
{-
isPrime :: Integer -> BoolisPrime n
| n < 2 = False
| otherwise = f 2 n
where f k n
= if k > isqrt
then True
else undefined -- exercise for the reader
-}
Hello Kalashnikov,
Thursday, October 16, 2008, 2:41:05 AM, you wrote:
> I'm supposed to write a function isPrime that checks whether or not a given
> integer is a prime number or not. The function has to use recursion. The
> only advice I was given, was to use a helper function.
seems that russi