fac(1, 1).
fac(N, X) :-
	N > 1,
	write(N),
	B is N-1,
	fac(B, A),
	X is N * A.


member(X, [X|R]).
member(X, [F|R]) :-
	member(X, R).
count(X, [], 0).
count(X, [X|T], Z) :-
	count(X,T,A),
	Z is A+1.
count(X,[H|T], Z) :-
	X =\= H,
	count(X,T,Z).


append([], X, X).
append([H|T1], X, [H|T2]) :-
	append(T1, X, T2).
	
