Solving equation involving factorial

1.2k Views Asked by At

I have the following problem:

$$ N^n(N-n)!=A $$

Where $N$ and $A$ are constants. I want to solve this equation for $n$ (for a variation of the birthday problem), but I have little experience with combinatorics.

An approximate answer is acceptable, so I've tried using Stirling's approximation, but no matter how I manipulate it, I can't get an answer to fall out.

Any guidance would be appreciated.

1

There are 1 best solutions below

4
On BEST ANSWER

The best method is going to depend quite a bit on the relative sizes of $N$ and $A$, but here's an idea that might work well in practice.

Divide both sides of the equation by $N!$ to yield $$ \frac A{N!} = \frac{N^n(N-n)!}{N!} = \prod_{j=0}^{n-1} \bigg( 1 - \frac jN \bigg)^{-1}. $$ Take logs of both sides to obtain \begin{align*} \log \frac A{N!} &= \sum_{j=0}^{n-1} \log \bigg( 1 - \frac jN \bigg)^{-1} \\ &= \sum_{j=0}^{n-1} \bigg( \frac jN + O\bigg( \frac{j^2}{N^2} \bigg) \bigg) \\ &= \frac{n(n-1)}{2N} + O\bigg( \frac{n^3}{N^2} \bigg). \end{align*} For many ranges of $N$ and $A$, this shows that $n$ will be about $\sqrt{2N\log(A/N!)}$.