$$f(n)=n!$$ Given a value $x$ , find $f^{-1}{(x)}$ [that is, such $n$ so that $f(n)=x$]. Constraints click to hide number of digit in $x$ is atmost $10^{6}$ Solution: At first, this problem seems too hard. Suppose, we have a bijective function $H(p)$ which return some small integer value for corresponding $p$. Hence, we can uniquely represent every $p$ by $H(p)$. How to make $H(p)$ click to hide $H(p) = p \text{ (mod $m$)}$ [for a choosen $m$]