Skip to content

Instantly share code, notes, and snippets.

@dmalikov
Last active December 15, 2015 08:39
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 dmalikov/5233047 to your computer and use it in GitHub Desktop.
Save dmalikov/5233047 to your computer and use it in GitHub Desktop.
α(L,P,R) :- β(L,P,R,0).
β([H|T],P,R,A) :- pow(H,P,X), β(T,P,R,A + X).
β([H],P,R,A) :- pow(H,P,X), R is A + X.
γ(X, Y, P) :- α(X, P, A), α(Y, P, B), A == B, !.
main(A) :- findall(X, (between(0,100,X), γ([0,3,5,6,9,10,12,15], [1,2,4,7,8,11,13,14], X)), A).
@dmalikov
Copy link
Author

$> swipl --quiet -s m.pl -g "main(X),print(X),nl,fail." -t halt.
[0,1,2,3]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment