Skip to content

Instantly share code, notes, and snippets.

@markchadwick
Created May 18, 2009 04:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markchadwick/113309 to your computer and use it in GitHub Desktop.
Save markchadwick/113309 to your computer and use it in GitHub Desktop.
sieve([]) ->
[];
sieve([H|T]) ->
[H|sieve(filter(fun(I) -> I rem H /= 0 end, T))];
sieve(Max) ->
sieve(seq(2, Max)).
main(_) ->
map(fun(I) -> io:format("~w~n", [I]) end, sieve(100)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment