Can't check equality with unknowns in Prolog

"Solve for X" is harder than evaluating 2*50 to get the result; it needs math knowledge of how to rearrange the equation to 100/4 = X. Classic Prolog doesn't have that built in, you would have to code it yourself.

But that kind of thing is in newer constraint solver libraries such as clpfd in SWI Prolog which gives you #= and can solve by finding integer answers to number problems:

:- use_module(library(clpfd)).

prod_hundred(X, Y) :- 
    X*Y #= 100.

Then:

?- prod_hundred(4, X).
X = 25

Try

factor(F,N) :- integer(N),
  L is N // 2 ,
  ( between(1,L,F) ; N ),
  0 =:= N rem F
  .
  
factors(X,Y,Z) :- integer(Z),
  factor(X,Z),
  factor(Y,Z),
  Z is X * Y
  .

prod_hundred(X,Y) :- factors(X,Y,100).