Skip to content

Instantly share code, notes, and snippets.

@nitrix
Created February 15, 2021 10:04
Show Gist options
  • Save nitrix/a3fac5788d273f17a9e1a998052bf711 to your computer and use it in GitHub Desktop.
Save nitrix/a3fac5788d273f17a9e1a998052bf711 to your computer and use it in GitHub Desktop.
main :-
natural(N),
N < 1000,
(multipleOf(3, N) ; multipleOf(5, N)),
converge(sum(N), Answer),
printLine(Answer).
------------------------- vs --------------------------
solution(N) :-
natural(N),
N < 1000,
(multipleOf(3, N) ; multipleOf(5, N)).
main :-
aggregate(sum(N), solution(N), Answer),
printLine(Answer).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment