Created
December 26, 2013 16:38
-
-
Save k-payl/8135809 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
%delete from 1st lst all composite numbers | |
main([], []). | |
main([H|T], Akk) :- just(H),!, main(T, Akk1), Akk = [H|Akk1]; | |
main(T, Akk). | |
just(V):- iter(V, 2). | |
iter(1, _):-!,fail. | |
iter(V, Par):- Par >= V, !; | |
V mod Par =\= 0,P1 is Par+1, iter(V, P1). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment