I have two related questions. Both are related to the asymptotics of Stirling's approximation, which is why I have included them in the same question. I will separate the questions if it is deemed necessary.
Consider Stirling's approximation. $$n! = \sqrt{2 \pi n} \left( \frac{n}{e} \right)^n \left( 1 + O \left(\frac{1}{n} \right)\right)$$ $$\lim_{n \rightarrow \infty} \frac{n!}{\sqrt{2 \pi n} \left( \frac{n}{e} \right)^n} = 1$$ The exact terms of the expression are more precisely described by Stirling's series. Unfortunately the series is not convergent so at some point, for each particular $n$ there is a term $a_{f(n)}$ of the expansion at which point summing terms increases the magnitude of relative error.
$f : \mathbb{N}^+ \rightarrow \mathbb{N}$ and for $n$ in the domain, $f(n)$ is defined as rank at which the magnitude of the terms in the asymptotic expansion of the ratio $\frac{n!}{\sqrt{2 \pi n} \left( \frac{n}{e} \right)^n \left(1+ \frac{1}{12n} + \cdots\right)}$ begins to increase.
My first question is what is known about $f(n)$? I believe it is known that $f(n)$ is monotonically increasing. Do we know the asymptotic growth of $f(n)$? If so, is there a known simple closed form expression for $f(n)$?
My second question has to do with error rates of Stirling's approximation and it depends on the first question having been resolved. Of course it is known that in the limit the relative error of approximating the factorial of $n$ approaches $0$. However, if one were to be interested in precisely how quickly the series well approximates the function, simple convergence in the limit is not enough. I would like to know the rate of convergence for the sequence $g(n) = \sum\limits_{i=0}^{f(n)} {a_i}$ in approximating $n!$. (Here $a_i$ are terms of the Stirling series).