?- ['factorial.pl']. /* Could also type pl -s factorial.pl at start */ % factorial.pl compiled 0.00 sec, 628 bytes Yes ?- listing(factorial/2). factorial(0, 1). factorial(A, B) :- A>0, C is A-1, factorial(C, D), B is A*D. Yes ?- factorial(10,What). What = 3628800 /* Hit return to get other possible solutions */ Yes ?- halt.