<s>[INST] 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)$.
 [/INST] 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}
</s>