Skip to content

Instantly share code, notes, and snippets.

@k-payl
Created December 26, 2013 16:38
Show Gist options
  • Save k-payl/8135809 to your computer and use it in GitHub Desktop.
Save k-payl/8135809 to your computer and use it in GitHub Desktop.
%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