diff options
| -rw-r--r-- | H31.hs | 5 | ||||
| -rw-r--r-- | H40.hs | 7 | ||||
| -rw-r--r-- | H41.hs | 9 | 
3 files changed, 21 insertions, 0 deletions
| @@ -1,3 +1,8 @@ +module H31 +(    isPrime +,    isPrimeT +) where +  import System.Random  isPrime :: Integral a => a -> Bool @@ -1,4 +1,9 @@ +module H40 +(   goldbach +) where +  import H35 +import H31  goldbach :: Integer -> (Integer, Integer)  goldbach x = sepToSum x primes $ reverse $ takeWhile (<x) primes @@ -7,3 +12,5 @@ goldbach x = sepToSum x primes $ reverse $ takeWhile (<x) primes              | h+t > n = sepToSum n hhs ts              | h+t < n = sepToSum n hs tts              | otherwise = (h,t) + +goldbach' n = head [(x,y) | x <- (takeWhile (<n) primes),let y = n - x, isPrimeT y] @@ -0,0 +1,9 @@ +import H40 + +goldbachList :: Integer -> Integer -> [(Integer,Integer)] + +goldbachList a b  +    | a `mod` 2 == 0 = map goldbach [a,(a+2)..b] +    | otherwise = goldbachList (a+1) b + +goldbachList' a b = filter ((>50).fst) $ goldbachList a b | 
