Created
July 5, 2014 15:04
-
-
Save ahmedissa/12534e6495c2549d19e1 to your computer and use it in GitHub Desktop.
erlang prime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(prime). | |
-export([init/1,sieb/1]). | |
init(Number) -> | |
sieb(lists:seq(2, Number)). | |
sieb (List) -> | |
case List of | |
[] -> | |
[]; | |
[_One | _Tail] -> | |
[_One] ++ sieb ([ K || K <- _Tail , K rem _One > 0]) | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment