summaryrefslogtreecommitdiff
path: root/H40.hs
blob: 448d3724af8f7ecebba1662bf7c6f32bdf110d26 (plain)
1
2
3
4
5
6
7
8
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)