A Factorial Problem

The code is failing for a test case specifically for values-

n=81624065 & k=46668091

I am unable to find fault in my approach. Kindly help.

Refer this -:
https://www.geeksforgeeks.org/find-maximum-value-of-x-such-that-n-kx-0/https://www.geeksforgeeks.org/find-maximum-value-of-x-such-that-n-kx-0/