Closely related to the SieveOfEratosthenes.
In HaskellLanguage,
primes = euler [2..] euler (x:xs) = x : euler (xs `minus` map (*x) (x:xs))(this code uses "minus" from DataListOrdered package, with obvious semantics; is due to Daniel Fischer, posted on haskell-cafe mailing list).