another way of doing factorial