diff options
author | Joe Zhao <ztuowen@gmail.com> | 2015-04-01 12:05:34 +0800 |
---|---|---|
committer | Joe Zhao <ztuowen@gmail.com> | 2015-04-01 12:05:34 +0800 |
commit | d09ec147fa223dcf760eaa592bc0573e678ea412 (patch) | |
tree | 636574b21abc2427d4fad059848f6bae7576e2f4 /H40.hs | |
parent | 3eec84838808139470261893ce15846852384bcf (diff) | |
download | h99-d09ec147fa223dcf760eaa592bc0573e678ea412.tar.gz h99-d09ec147fa223dcf760eaa592bc0573e678ea412.tar.bz2 h99-d09ec147fa223dcf760eaa592bc0573e678ea412.zip |
+39 +40
Diffstat (limited to 'H40.hs')
-rw-r--r-- | H40.hs | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -0,0 +1,9 @@ +import H35 + +goldbach :: Integer -> (Integer, Integer) +goldbach x = sepToSum x primes $ reverse $ takeWhile (<x) primes + where + sepToSum n hhs@(h:hs) tts@(t:ts) + | h+t > n = sepToSum n hhs ts + | h+t < n = sepToSum n hs tts + | otherwise = (h,t) |