Want to expand the argument q(M,N):-
that should evaluate true , only if
we can express M
as sum of two numbers , that also these same two numbers would give the the product of N
. Meaning something like A+B=M
and A*B=N
(M,N>0
both Integers)
So I've tried something like :
sum(A,B,M) :- M is A+B.
prod(A,B,N) :- N is A*B.
q(M,N) :- sum(A,B,M),
prod(A,B,N).
But yeah not a great plan.
some expected outcomes should be:
| ?- q(18,45).
yes
| ?- q(45,18).
no
| ?- q(4,4).
yes
| ?- q(5,5).
no
| ?- q(16,64).
yes
| ?- q(12,25).
no
| ?- q(25,24).
yes
| ?- q(36,120).
no
| ?- q(100,2499).
yes
| ?- q(100,267).
no
| ?- q(653,98770).
yes
| ?- q(653,98880).
no