2024-12-05 12:43:06 +01:00

22 lines
562 B
Haskell

--module Primes ( aspGetNextPrime, aspIsPrime, aspPrimes ) where
module Primes ( aspGetNextPrime, aspIsPrime ) where
import Problems ( kth )
aspGetNextPrime :: Int -> Int
aspGetNextPrime 1 = 2
aspGetNextPrime 2 = 3
aspGetNextPrime n = aspGetNextPrime (n + 2)
aspIsPrime :: Int -> Bool
aspIsPrime 1 = False
aspIsPrime n = mod n (aspGetNextPrime 1) == 0
-- where
-- recMod
--aspPrimeFactors :: Int -> [Int]
--aspPrimeFactors 1 = [1]
--aspPrimes :: (Integral Int) => [Int]
--aspPrimes = sieve [2..]
-- where sieve (x:xs) = [ x | x <- xs, x mod p == 0]