Solution (source code)

= Solution

Put $L=\log\lambda$ and integrate by parts using $x^{-2}=-d(x^{-1})/dx$. The exponential cutoff has <derivative> $\lambda e^{-x}e^{-\lambda e^{-x}}$, so the endpoint at infinity vanishes and the lower endpoint gives
$$
I(\lambda)=e^{-\lambda/e}+\int_1^\infty\frac{\lambda e^{-x}e^{-\lambda e^{-x}}}{x}\,dx.
$$
With $u=\lambda e^{-x}$ this becomes
$$
I(\lambda)=e^{-\lambda/e}+\int_0^{\lambda/e}\frac{e^{-u}}{L-\log u}\,du.
$$
The mass of the transformed <integral> lies at $u=O(1)$, where
$$
\frac1{L-\log u}=\frac1L+\frac{\log u}{L^2}
+O\left(\frac{(\log u)^2}{L^3}\right).
$$
To control this <asymptotic expansion>, split at $u=e^{-L/2}$ and $u=e^{L/2}$. On the central interval the geometric-series remainder is bounded by $2(\log u)^2/L^3$, whose <integral> against $e^{-u}$ is finite. The lower tail has length $e^{-L/2}$ and denominator at least $L$; the upper tail is exponentially small in $e^{L/2}$, with the original denominator at least one. The omitted tails of the logarithmic moments are likewise negligible. Thus extending the moments to $(0,\infty)$ is justified.

The <Gamma function> gives $\int_0^\infty e^{-u}\,du=1$, and the first logarithmic moment is $-\gamma$, with $\gamma$ <Euler's constant>. Therefore
$$
\boxed{I(\lambda)=\frac1{\log\lambda}
-\frac\gamma{(\log\lambda)^2}
+O\bigl((\log\lambda)^{-3}\bigr)}.
$$
This is the <moving Gumbel cutoff in an inverse-power tail>: replacing the original cutoff by a sharp step at $x=\log\lambda$ gives the first term, but its smooth transition supplies the Euler-constant correction.