# Calculating the limit of a sequence?

In one of the exercises I got, I was required in order to proceed to calculate the limit:

$\lim_{n\to \infty} (\frac 1 {e^n} (1+ \frac 1 n)^{n^2})$

I checked in the solution sheet to see if the answer will give me a clue, and the answer is supposed to be $\frac 1 {\sqrt e}$ but I still can't see how I get there... Can anyone please give me a clue? :)

$\frac 1 {e^x} (1+ \frac 1 x)^{x^2}=\left(\frac{\left(1+\frac{1}{x}\right)^x}{e}\right)^x=e^{x\left(ln\left(1+\frac{1}{x}\right)^x-lne\right)}=e^{\frac{ln\left(1+\frac{1}{x}\right)^x-1}{\frac{1}{x}}}$
If $a_n = \frac 1 {e^n} (1+ \frac 1 n)^{n^2}$, then
$\begin{array}\\ \ln a_n &=n^2\ln (1+ \frac 1 n)-n\\ &=n^2(\frac1{n}-\frac1{2n^2}+O(\frac1{n^3}))-n\\ &=(n-\frac12+O(\frac1{n}))-n\\ &=-\frac12+O(\frac1{n})\\ &\to -\frac12\\ \end{array}$
so $a_n \to e^{-1/2}$.