<s>[INST] Alternative approaches to showing that $\gamma=\int_0^\infty \left(\frac{1}{1+x^a}-\frac{1}{e^x}\right)\,\frac1x\,dx$, $a>0$ Starting from the limit definition of the Euler-Mascheroni constant $\gamma$ as given by

$$\gamma=\lim_{n\to \infty}\left(-\log(n)+\sum_{k=1}^n\frac1k\right)\tag 1$$

we can show that $\gamma$ has an integral representation

$$\gamma=\int_0^\infty\left(\frac{1}{e^x-1}-\frac{1}{xe^x}\right)\,dx \tag 2$$



Proof of $(2)$:  This is provided for completeness only and one can skip this part without losing context.

To show that the integral in $(2)$ is equivalent to $(1)$, we can proceed as follows.
$$\begin{align}
\int_0^\infty\left(\frac{1}{e^x-1}-\frac{1}{xe^x}\right)\,dx&=
\int_0^\infty \frac{e^{-x}}{1-e^{-x}}\left(1-\frac{1-e^{-x}}{x}\right)\,dx\\\\
&=\sum_{k=1}^\infty \int_0^\infty\left(e^{-kx}-\frac{e^{-kx}-e^{-(k+1)x}}{x}\right)\,dx\\\\
&=\sum_{k=1}^\infty \left(\frac{1}{k}-\log\left(\frac{k+1}{k}\right)\right)\\\\
&=\lim_{n\to \infty}\sum_{k=1}^n \left(\frac1k -\log\left(\frac{k+1}{k}\right)\right)\\\\
&=\lim_{n\to \infty}\left(-\log(n+1)+\sum_{k=1}^n\frac1k\right)\\\\
&=\lim_{n\to \infty}\left(-\log(n)+\sum_{k=1}^n\frac1k\right)\\\\
\end{align}$$

Another integral representation for $\gamma$ is given by

$$\gamma=\int_0^\infty \left(\frac{1}{x(1+x^a)}-\frac{1}{xe^x}\right) \,dx \tag 3$$

for $a>0$.
Equipped with $(2)$, we can show the equivalence of $(3)$ with $(1)$ by showing that

$$\int_0^\infty \left(\frac{1}{x(1+x^a)}-\frac{1}{e^x-1}\right)\,dx=0\tag 4$$


To prove $(4)$, I proceeded as follows.
$$\begin{align}
\lim_{\epsilon\to 0^+}\int_{\epsilon}^\infty\left(\frac{1}{x(1+x^a)}-\frac{1}{e^x-1}\right)\,dx &=\lim_{\epsilon\to 0^+}\left.\left(-\frac1a \log(1+x^{-a})-\log(1-e^{-x})\right)\right|_{\epsilon}^{\infty}\\\\
&=\lim_{\epsilon\to 0^+}\left(\frac1a \log(1+\epsilon^{-a})+\log(1-e^{-\epsilon})\right)\\\\
&=0
\end{align}$$
And we are done!

This approach seemed a bit cumbersome and indirect.

QUESTION: So, what are alternative approaches to establishing equivalence of $(3)$ and $(1)$?

 [/INST] The same idea as in my previous answer applies. Notice that
$$ f(x) = \frac{1}{1+x} \quad \Rightarrow \quad \int_{\epsilon}^{\infty} \frac{f(x)}{x} \, dx = -\log\epsilon + \log(1+\epsilon) = -\log\epsilon + o(1) $$
as $\epsilon \to 0^+$. Now from the linked answer above, we find that
\begin{align*}
f(x) = e^{-x}
&\quad \Rightarrow \quad c(f) = \lim_{R\to\infty} \left( \int_{0}^{R} \frac{ds}{1+s} - \log R \right) - \gamma = -\gamma \\
&\quad \Rightarrow \quad \int_{\epsilon}^{\infty} \frac{e^{-x}}{x} \, dx = -\log\epsilon - \gamma + o(1).
\end{align*}
It is worth to remark that the $\gamma$ term above is computed from the identity $\gamma = -\int_{0}^{\infty} e^{-x}\log x \, dx$, which you are already aware of. From this,
\begin{align*}
\int_{\epsilon}^{\infty} \frac{1}{x^a + 1} \, \frac{dx}{x} - \int_{\epsilon}^{\infty} e^{-x} \, \frac{dx}{x}
&= \frac{1}{a}\int_{\epsilon^a}^{\infty} \frac{1}{x + 1} \, \frac{dx}{x} - \int_{\epsilon}^{\infty} e^{-x} \, \frac{dx}{x}\\
&= \gamma + o(1)
\end{align*}
and taking $\epsilon \to 0^+$ gives the result.

Using the quantity $c(f)$, you can compute various integrals (including all the integrals you have asked) together with some tabulated results for $c(f)$:
\begin{align*}
c\left\{\frac{1}{(1+x)^\alpha}\right\} &= -H_{\alpha-1}, &
c\{e^{-x}\} &= -\gamma, \\
c\left\{\frac{x}{e^x-1}\right\} &= 0, &
c\{\cos x\} &= -\gamma,
\end{align*}
where $H_n$ is the harmonic numbers. For instance, if $a > 0$ then
\begin{align*}
\int_{0}^{\infty} \left( \frac{1}{\sqrt{1+a x}} - e^{-x^2} \right) \frac{dx}{x}
&= c\left\{ \frac{1}{\sqrt{1+a x}} - e^{-x^2} \right\} \\
&= c\left\{ \frac{1}{\sqrt{1+a x}} \right\} - c\{e^{-x^2}\} \\
&= c\left\{ \frac{1}{\sqrt{1+x}} \right\} - \log a - \frac{1}{2}c\{e^{-x}\} \\
&= H_{-1/2} - \log a + \frac{\gamma}{2} \\
&= \frac{\gamma}{2} - \log(4a).
\end{align*}
</s>