Hard improper integral $\int_0^\infty \frac{(1+\frac{1}{x})^{-x}}{x^2}dx $ I have been stuck on this problem for a while:
$$\int_0^\infty \frac{(1+\frac{1}{x})^{-x}}{x^2}dx $$
I have toyed around with substitution and integration by parts with no luck. I have also searched for this on the internet but nothing has come up. Any help would be appreciated
 A: Note that $f:(0, 1] \to \Bbb R$ defined by
$$f(x) = \left(1 + \frac1x\right)^{-x}$$
is a decreasing function and thus, $f(x) \ge f(1) = 0.5$.
As a result, your integrand exceeds $0.5x^{-2}$ on $(0, 1]$. However, the improper integral of $x \mapsto x^{-2}$ diverges on $(0, 1]$. By comparison, so does your integral.
A: As mentioned, the integral as written diverges. It is easy to see that the controlling factor of $\int\limits_a^\infty dx \ x^{-2} (1+1/x)^{-x}$ is $1/a$ as $a \to 0$. By itself this is not a good approximation. I'm going to consider the integrals
$$
I(a)=\int\limits_a^1 dx \ x^{-2} (1+1/x)^{-x} \\
J(b)=\int\limits_1^b dx \ x^{-2} (1+1/x)^{-x}
$$
For $I(a)$, expand the term $(1+1/x)^{-x}$ around $x=0$, and then integrate term by term
$$
I(a)=\int\limits_a^1 dx \ x^{-2} \left(1+x \ln(x)+ \dots \right) \\
I(a) \sim \frac{1}{a}-1-\frac{1}{2}\ln(a)\ln(a) \ \ , \ \ a \to 0
$$
Here is a plot of the two term series versus the numerical result for $I(a)$:

For $J(b)$, I propose replacing $(1+1/x)^{-x}$ with a Pade approximant around $x=1$, where the integrand is maximum. I'm using $P^1_1$. Let $\mathcal{J}$ be our approximation for $J$
$$
\mathcal{J}(b)=\int\limits_1^b dx \ x^{-2} \left( \frac{1+\alpha(x-1)}{2+\beta(x-1)} \right) 
$$
Where $\alpha= \frac{\ln(2)(\ln(2)-1)}{\ln(4)-1}$, $\beta=\frac{2\ln(2)\ln(2)}{\ln(4)-1}-1$, I'll give the indefinite integral here, so I only have to write one awful equation instead of two
$$
\mathcal{J}(b)=\frac{-(\alpha-1)(\beta-2) + x(2\alpha-\beta)(\ln(x)-\ln(2+\beta(x-1))}{x(\beta-2)^2}\Bigg\vert_1^b
$$
Here is a plot of $\mathcal{J}$ versus the numeric result:

