How can I unfactorilize number?

588 Views Asked by At

Consider the equation

$x! = y$

Say we know $y$ and were trying to find $x$:

What method could I use to get $x$ (e.g. a closed formula)?

2

There are 2 best solutions below

2
On BEST ANSWER

The factorial function is a special case of the Gamma function, which satisfies for positive integers $n$ $$ \Gamma(n) = (n-1)!, $$ so what you really want is an inverse to this function. In general the inverse is not simple, but this has been discussed here.

5
On

Are you insisting that solutions be integer? If so, start by dividing $y$ by $2$, then the quotient by $3$, then the quotient of that by $4$, and so on. If you reach $1$, there is a solution and the last number you divided by is $x$. If you reach smaller than $1$ before reaching $1$, there is no integer solution.