sieve :: [Int] -> [Int] -> [Int] -- sieve [] xs -- Assuming that xs is a list of the form [2..max], returns a list of -- primes between 2 and max. The first parameter is an accumulator -- list. -- -- This is a loose interpretation of the Sieve of Eratosthenes; instead -- of marking composite numbers, we remove them. sieve p [] = reverse p sieve p (x:xs) = sieve (x:p) (filter (\t -> (rem t x /= 0)) xs)