Asymptotic behaviour of $\frac{n^n}{n^n - (n - 1)^n + 1}$ for large $n$ I am interested in the behaviour when $n$ is large of the following function:
$$f(n) := \frac{n^n}{n^n - (n - 1)^n + 1}.$$
The limit of this function as $n$ approaches infinity is
$$\lim_{n \to \infty} f(n) = \frac{e}{e - 1},$$
where $e$ is Napier's Constant.
However, I would like to have more information about this function, such as a series expansion at $n = \infty$, where the dominant term is $e/(e - 1)$, and there is an explicit error term that is $o(1)$ as $n \to \infty$.
Wolfram Alpha doesn't want to give any expansion. Mathematica gives some expansion, but it is not immediate from the expression even that the limit is $e/(e - 1)$.
 A: Here are the details of Greg Martin's answer.
First,
$$f(n) = \frac{1}{1 - (1 - \frac{1}{n})^n + n^{-n}}.$$
Since
$$\log(1 - \frac{1}{n})^n = n\log(1 - \frac{1}{n}) = n(-\frac{1}{n} - \frac{1}{2} \frac{1}{n^2} + O(\frac{1}{n^3})) = - 1 - \frac{1}{2}\frac{1}{n} + O(\frac{1}{n^2}),$$
exponentiating gives
$$(1 - \frac{1}{n})^n = e^{-1 - \frac{1}{2}\frac{1}{n} + O(\frac{1}{n^2})} = \frac{1}{e} -\frac{1}{2e} \frac{1}{n} + O(\frac{1}{n^2}).$$
Hence, as $n^{-n} = O(1/n^2)$,
$$(1 - \frac{1}{n})^n - n^{-n} = \frac{1}{e} -\frac{1}{2e} \frac{1}{n} + O(\frac{1}{n^2}),$$
also.
Therefore
\begin{align}
f(n) &= \frac{1}{1 - ((1 - \frac{1}{n})^n - n^{-n})} = \frac{1}{1 - (\frac{1}{e} -\frac{1}{2e} \frac{1}{n} + O(\frac{1}{n^2}))} = \frac{e}{e - 1 - \frac{1}{2}\frac{1}{n} + O(\frac{1}{n^2})} \\
&= \frac{e}{e - 1}\left(\frac{1}{1 - \frac{1}{2(e - 1)}\frac{1}{n} + O(\frac{1}{n^2})}\right) = \frac{e}{e - 1}(1 - \frac{1}{2(e - 1)} \frac{1}{n} + O(\frac{1}{n^2})).
\end{align}
A: $$f_n= \frac{n^n}{n^n - (n - 1)^n + 1}\implies g_n=\frac 1{f_n}=1+n^{-n}-\left(\frac {n-1}n\right)^n$$
$$h_n=\left(\frac {n-1}n\right)^n\implies \log(h_n)=n\log\left(1-\frac {1}n\right)$$
$$\log(h_n)=-1-\frac{1}{2 n}-\frac{1}{3 n^2}+O\left(\frac{1}{n^3}\right)$$
$$h_n=e^{\log(h_n)}=\frac{1}{e}-\frac{1}{2 e n}-\frac{5}{24 e
   n^2}+O\left(\frac{1}{n^3}\right)$$
$$g_n=1+\frac{1}{e}-\frac{1}{2 e n}-\frac{5}{24 e
   n^2}+O\left(\frac{1}{n^3}\right)$$
$$f_n=\frac 1{g_n}=\frac{e}{e-1}\Bigg[1-\frac{1}{2 (e-1) n}+\frac{11-5 e}{24 (e-1)^2  n^2}+O\left(\frac{1}{n^3}\right) \Bigg]$$
Try it for $n=5$. The exact value is
$$f_5=\frac{3125}{2102}=1.48668\cdots$$ while the truncated expansion gives
$$f_5\sim \frac{e \left(671-1265 e+600 e^2\right)}{600 (e-1)^3}=1.48760\cdots$$ which is in a relative error of $0.062$%.
