From b47befab3696c40c710ee80f366fa376ec967b30 Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Wed, 1 Apr 2015 17:41:53 +0800 Subject: +40 +41 --- H31.hs | 5 +++++ H40.hs | 7 +++++++ H41.hs | 9 +++++++++ 3 files changed, 21 insertions(+) create mode 100644 H41.hs diff --git a/H31.hs b/H31.hs index 9c321ca..7c0c8a6 100644 --- a/H31.hs +++ b/H31.hs @@ -1,3 +1,8 @@ +module H31 +( isPrime +, isPrimeT +) where + import System.Random isPrime :: Integral a => a -> Bool diff --git a/H40.hs b/H40.hs index 448d372..4a31727 100644 --- a/H40.hs +++ b/H40.hs @@ -1,4 +1,9 @@ +module H40 +( goldbach +) where + import H35 +import H31 goldbach :: Integer -> (Integer, Integer) goldbach x = sepToSum x primes $ reverse $ takeWhile ( n = sepToSum n hhs ts | h+t < n = sepToSum n hs tts | otherwise = (h,t) + +goldbach' n = head [(x,y) | x <- (takeWhile ( 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 -- cgit v1.2.3-70-g09d2