In Bollobas' proof of the chromatic number of random graphs with constant $p$, he computes the value $r \in \mathbb{R}$ for which the expected number of $r$-cliques in $G(n,p)$ is exactly one:
Given $\binom{n}{r} p^{\binom{r}{2}} = 1$, I want to obtain an expression for $r$.
In particular, applying Stirling approximation $$n! \sim \sqrt{2 \pi n} (n/e)^n$$ We see that
$\binom{n}{r} p^{\binom{r}{2}} \sim (2 \pi)^{-1/2} n^{n+1/2} (n-r)^{-n+r-1/2} r^{-r-1/2} p^{r(r-1)/2}$
So, my aim is to isolate $r$ in:
$(2 \pi)^{-1/2} n^{n+1/2} (n-r)^{-n+r-1/2} r^{-r-1/2} p^{r(r-1)/2} = 1$
Setting $b = 1/p$, I know the answer I should get is:
$r = 2 \log_b n - 2 \log_b \log_b n + 2 \log_b\left(\frac{e}{2}\right) + 1 + o(1)$
However... I dont know how can I do it. I would be grateful if someone can help me!
Thanks!