how to solve for a n-factorial?