All pastes #335165 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-02-01 04:24 UTC
rendered paste body
isPrime n = isPrime' 2
  where
    isPrime' m
          | m > round(sqrt n) = True
          | mod (truncate n) m /= 0 = isPrime' (m + 1)
          | otherwise = False

isPrime2 n = isPrime2' 2
  where
    isPrime2' m
          | m > 737413 = True
          | mod (truncate n) m /= 0 = isPrime2' (m + 1)
          | otherwise = False


-------

*primes> isPrime 543777773381
True
(20.51 secs, 758485556 bytes)
*primes> isPrime2 543777773381
True
(10.36 secs, 322285956 bytes)