. , - :
number(1).
number(N) :- number(N-1).
rational(X) :- number(A), number(B), X is A/B.
A, B, C, :
?- rational(A), rational(B), rational(C), A+B+C=:=1,A**2+B**2+C**2=:=2,A**3+B**3+C**3=:=3.
However, I suspect that the search order for the set of rational numbers will hit infinity for A before the second value for B is used. A workaround / cheat (assuming some knowledge of the solution) would only determine numbers less than (say) 100 to limit the search space.
number(1).
number(N) :- N <= 100, number(N-1).
Sorry if my syntax is a bit off. I have not used Prolog for a long time.
source
share