Factorial implementation in Prolog (with my modifications) added.