Changed repository to a cabal structure
This commit is contained in:
21
app/Primes.hs
Normal file
21
app/Primes.hs
Normal file
@ -0,0 +1,21 @@
|
||||
--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]
|
Reference in New Issue
Block a user