<s>[INST] An arctan exponential integral Prove the following for $\Re(z) >0$
$$ \log(\Gamma(z)) = 2\int_{0}^{\infty} \tan^{-1} \left(\dfrac{t}{z}\right)\dfrac{\mathrm{d}t}{e^{2\pi t} - 1} + \dfrac{\log(2z)}{2} + \left( z - \dfrac{1}{2} \right)\log (z) -z  $$
I found this identity on Wolfram Functions here. I can't see where to start solving this problem.  
I'm looking for elementary solution, I haven't learned about Complex Analysis or Abel Plana formula yet.
Please help.
Thanks.
 [/INST] 
Proposition : $$\int_{0}^{\infty} \dfrac{\log(1-e^{-2a\pi x})}{1+x^2} \mathrm{d}x = \pi \left[\dfrac{1}{2} \log (2a\pi ) + a(\log a - 1) - \log(\Gamma(a+1)) \right]$$     

Proof : Let $ \displaystyle \text{I} (a) = \int_{0}^{\infty} \dfrac{\log(1-e^{-2a\pi x})}{1+x^2} \mathrm{d}x$  
$\displaystyle  = -\sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \dfrac{e^{-2ar \pi x}}{1+x^2} \mathrm{d}x $  
$\displaystyle  = -\sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \int_{0}^{\infty} e^{-x(2ar \pi + y)} \sin y \ \mathrm{d}y \ \mathrm{d}x $  
$\displaystyle  = -\sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \dfrac{\sin y}{2ar\pi + y} \mathrm{d}y $  
$\displaystyle  = - \sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \dfrac{\sin x}{2ar\pi + x} \mathrm{d}x$  
Substitute $\displaystyle  x \mapsto 2 r \pi x$  
$\displaystyle \implies \text{I}(a)  = - \sum_{r=1}^{\infty} \dfrac{1}{r} \int_{0}^{\infty} \dfrac{\sin 2 r \pi x}{x + a} \mathrm{d}x $  
$\displaystyle  = -\int_{0}^{\infty} \dfrac{1}{x+a} \sum_{r=1}^{\infty} \dfrac{\sin(2 r \pi x)}{r} \mathrm{d}x $  
$\displaystyle  = -\pi \int_{0}^{\infty} \dfrac{1}{x+a} \left(\dfrac{1}{2} - \{x\} \right) \mathrm{d}x \quad \left( \because \sum_{r=1}^{\infty} \dfrac{\sin (2 r \pi x)}{r} = \dfrac{\pi}{2} - \pi \{x\} \right) $  
$\displaystyle = -\pi \left[ \int_{0}^{\infty} \dfrac{\mathrm{d}x}{2(x+a)} - \int_{0}^{\infty} \dfrac{\{x\}}{x+a} \mathrm{d}x \right] $  
$\displaystyle  = -\pi \lim_{n \to \infty} \left[ \dfrac{1}{2} \log \left(\dfrac{a+n}{a}\right) - \text{A}(n) \right]$  
where $\displaystyle  \text{A}(n) = \int_{0}^{n} \dfrac{\{x\} }{x+a} \mathrm{d}x$   
Now, 
$\displaystyle \text{A}(n) = \int_{0}^{n} \dfrac{\{x\} }{x+a} \mathrm{d}x $  
$\displaystyle  = \sum_{k=0}^{\infty} \int_{k}^{k+1} \dfrac{x-k}{x+a} \mathrm{d}x $    
$\displaystyle  = \sum_{k=0}^{\infty} \left[1 - (k+a)\log \left(\dfrac{k+a+1}{k+a}\right) \right] $  
$\displaystyle  = n - \sum_{k=0}^{\infty} \left[ (k+a+1) \log (k+a+1) - (k+a) \log (k+a) - \log (k+a+1) \right] $     
$\displaystyle  = n + a\log a - (a+n) \log (a+n) +\log(a \cdot (a+1) \cdot \ldots \cdot (a+n)) - \log a $    
$\displaystyle  \implies \text{I} (a) = -\pi \lim_{n \to \infty} \left[ \dfrac{1}{2} \log \left(\dfrac{a+n}{a}\right) - n - a\log a + (a+n) \log (a+n) - \log(a \cdot (a+1) \cdot \ldots \cdot (a+n)) + \log a  \right] $    
Note that $\displaystyle  \lim_{n \to \infty} \dfrac{ n! n^t}{t \cdot (t+1) \cdot \ldots \cdot (t+n)} = \Gamma(t) $    
$\displaystyle  \implies \text{I} (a) = -\pi \lim_{n \to \infty}  \left[ \dfrac{1}{2} \log \left(\dfrac{a+n}{a}\right) - n - a\log a + (a+n) \log (a+n) - a\log(n) - \log (n!) + \log(\Gamma(a)) + \log a  \right] $  
Simplifying using Stirling's Approximation and $\displaystyle  \lim_{n \to \infty } n \log \left(1 + \dfrac{a}{n} \right) = a $, we have,  
$\displaystyle  \text{I} (a) = -\pi \left[\log(\Gamma(a+1)) - \dfrac{1}{2} \log(2a \pi) - a (\log(a) -1) \right]  $  
$\displaystyle  = \pi \left[ \dfrac{1}{2} \log(2a \pi) + a (\log(a) -1) - \log(\Gamma(a+1)) \right] \quad \square $   
Now, 
Applying Integration By Parts on the proposition and simplifying, we get,  
$ \displaystyle \int_{0}^{\infty} \tan^{-1} \left(\dfrac{t}{a}\right)\dfrac{\mathrm{d}t}{e^{2\pi t} - 1} = \dfrac{1}{2} \left[ \log(\Gamma(a)) - \dfrac{\log(2a)}{2} - \left( a - \dfrac{1}{2} \right)\log (a) +a\right]  $    
$$\therefore \log(\Gamma(a)) = 2\int_{0}^{\infty} \tan^{-1} \left(\dfrac{t}{a}\right)\dfrac{\mathrm{d}t}{e^{2\pi t} - 1} + \dfrac{\log(2a)}{2} + \left( a - \dfrac{1}{2} \right)\log (a) -a \quad \square $$
</s>