Calculates the factorial of any given integer