Skip to content

Instantly share code, notes, and snippets.

@ahafidi
Last active November 2, 2020 08:27
Show Gist options
  • Save ahafidi/f7b9bae67d846339ba3f02e9f886a6b8 to your computer and use it in GitHub Desktop.
Save ahafidi/f7b9bae67d846339ba3f02e9f886a6b8 to your computer and use it in GitHub Desktop.
Haskell — Prime numbers
primes = filterPrime [2..]
where filterPrime (p:xs) =
p : filterPrime [x | x <- xs, x `mod` p /= 0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment