Skip to content

Instantly share code, notes, and snippets.

@mikamix
Created December 28, 2013 22:52
Show Gist options
  • Save mikamix/8165233 to your computer and use it in GitHub Desktop.
Save mikamix/8165233 to your computer and use it in GitHub Desktop.
euler9(Answer) :-
between(1, 999, A),
between(A, 999, B),
C is 1000 - A - B,
is_pythagorean_triplet(A, B, C),
Answer is A * B * C.
is_pythagorean_triplet(A, B, C) :-
A < B, B < C,
A ^ 2 + B ^ 2 =:= C ^ 2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment