Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- is_prime(N)->is_prime(N,2,erlang:trunc(math:sqrt(N))).
- is_prime(1,_X,_E)->false;
- is_prime(2,_X,_E)->true;
- is_prime(N,X,_E) when N rem X ==0->false;
- is_prime(N,X,E) when X =< E->is_prime(N,X+1,E);
- is_prime(_N,_X,_E)->true.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement