I'm trying to use the Gosper's factorial approximation to get a rough value of the maximal integer $n$ in $$n!\approx n^ne^{-n}\sqrt{\left(2n+\frac13\right)\pi} = 2^p$$ while avoiding to calculate the loop $F=\prod_{i=1}^{n}$ while $F$ is smaller than $2^p$ (and handling overflows). $p$ itself is a positive integer being a power of $2$.
This is for a computer algorithm that works with on integer lengths, that can be $p = 16$, $32$, $64$, $128$, $256$... ($p$ is a constant, known before the algorithm is evaluated, and is itself $p=2^b$, $b$ number of bits). The actual (unsigned) integer maximal value is actually $2^p-1$, but, to simplify, let's use $2^p$.
Starting from $$n^ne^{-n}\sqrt{\left(2n+\frac13\right)\pi} = 2^p$$ I thought going with the (natural) $\log$ could be helpful $$n\log(n)-n+\dfrac 12\log{\left((2n+\frac13)\pi\right)} = p\log (2)$$ but from here...
Maybe there is a better idea to approximate $n$ that costs less than $O(p)$? (approximation of the actual time complexity)
(Even if all $n$ values up to the max $b$ could be pre-calculated, let's assume the general case since we're on Math SE)