fact(0,1). fact(X,Y) :- fact(Xp,Yp), X is Xp+1, Y is Yp*X.