Factorial problem in maths section


My code is not working for all the test cases. May I know my mistake please?