Geometry problem boils down to finding a closed form for $\sum_{n=1}^{k}{\arctan{\left(\frac{1}{n}\right)}}$ I was solving the following problem:
"Find $\angle A + \angle B + \angle C$ in the figure below, assuming the three shapes are squares."

And I found a beautiful one-liner using complex numbers:
$(1+i)(2+i)(3+i)=10i$, so $\angle A + \angle B + \angle C = \frac{\pi}{2}$
Now, I thought, what if I want to generalize? What if, instead of three squares, there were $2018$ squares? What would the sum of the angles be then? Could I make a formula for $k$ squares?
Essentially, the question boiled down to finding a closed form for the argument of the complex number
$$\prod_{n=1}^{k}{(n+i)}=\prod_{n=1}^{k}{\left(\sqrt{n^2+1}\right)e^{i\cot^{-1}{n}}}$$
This we can break into two parts, finding a closed form for
$$\prod_{n=1}^{k}{(n^2+1)}$$
and
$$\sum_{n=1}^{k}{\cot^{-1}{n}}$$
This I don't know how to solve.
 A: With CAS help:
$$\sum _{n=1}^k \tan ^{-1}\left(\frac{1}{n}\right)=\\\int \left(\sum _{n=1}^k \frac{\partial }{\partial a}\tan ^{-1}\left(\frac{a}{n}\right)\right) \, da=\\\int \left(\sum _{n=1}^k \frac{n}{a^2+n^2}\right) \,
   da=\\\int \frac{1}{2} \left(-H_{-i a}-H_{i a}+H_{-i a+k}+H_{i a+k}\right) \,
   da=\\-\frac{1}{2} i (\text{log$\Gamma $}(1-i a)-\text{log$\Gamma $}(1+i a)-\text{log$\Gamma
   $}(1-i a+k)+\text{log$\Gamma $}(1+i a+k))+C$$
where $a=1$ and $C=0$ then:
$$\color{blue}{\sum _{n=1}^k \tan ^{-1}\left(\frac{1}{n}\right)=-\frac{1}{2} i (\text{log$\Gamma
   $}(1-i)-\text{log$\Gamma $}(1+i)-\text{log$\Gamma $}((1-i)+k)+\text{log$\Gamma
   $}((1+i)+k))}$$
Where: $H_{i a}$ is harmonic number and $\text{log$\Gamma $}(1-i)$ is  logarithm of the gamma function
MMA code:
HoldForm[Sum[ArcTan[1/n], {n, 1, k}] == -(1/2)
I (LogGamma[1 - I] - LogGamma[1 + I] - LogGamma[(1 - I) + k] + LogGamma[(1 + I) + k])] // TeXForm

A: We have that
$$
\prod\limits_{1\, \le \,n\, \le \,k} {\left( {i + n} \right)}  = {1 \over i}\prod\limits_{0\, \le \,n\, \le \,k} {\left( {i + n} \right)}
  = {1 \over i}i^{\,\overline {\,k + 1\,} }  = \left( {1 + i} \right)^{\,\overline {\,k\,} } 
 = {{\Gamma \left( {1 + i + k} \right)} \over {\Gamma \left( {1 + i} \right)}} = k!\left( \matrix{
  i + k \cr 
  k \cr}  \right)
$$
where $x^{\,\overline {\,k\,} }  = {{\Gamma (x + k)} \over {\Gamma (x)}}$ denotes the Rising Factorial 
and $x^{\,\underline {\,k\,} }  = \left( {x - k + 1} \right)^{\,\overline {\,k\,} } $ the Falling Factorial.
By means of the expression through The Gamma Function, they are defined as meromorphic 
functions even for complex $x$ and $k$.
Then
$$
\ln \left( {z^{\,\overline {\,k\,} } } \right) = \ln \left( {\left| {z^{\,\overline {\,k\,} } } \right|} \right) + i\arg \left( {z^{\,\overline {\,k\,} } } \right)
 = \ln {{\Gamma (z + k)} \over {\Gamma (z)}}
$$
The above tells us that your question is related to the absolute value and argument of the Gamma Function,
which unfortunately do not have a closed expression, better than the above.
A: Note that the addition formula for the arctangent gives $\arctan(x)+\arctan(y)=\arctan(\dfrac{x+y}{1-xy})$; thus, if we define $\alpha_n$ by $\arctan(\alpha_n)=\sum_{i=1}^n\arctan(\frac1i)$, then we have $\alpha_n=\dfrac{\alpha_{n-1}+\frac1n}{1-\frac{\alpha_{n-1}}{n}}$ $=\dfrac{n\alpha_{n-1}+1}{n-\alpha_{n-1}}$; alternately, setting $\alpha_n=\frac{a_n}{b_n}$, we can write this as $a_n=na_{n-1}+b_{n-1}, b_n = -a_{n-1}+nb_{n-1}$ - or $\begin{pmatrix}a_n \\ b_n \end{pmatrix} = \begin{pmatrix}n & 1 \\ -1 & n\end{pmatrix}\begin{pmatrix}a_{n-1} \\ b_{n-1} \end{pmatrix}$.  This 'blows up' at $n=3$ (since there's a division by zero), but because the equation in terms of $a_n$ and $b_n$ is homogeneous, we can continue through that point with a rescaling: $(a_n, b_n) (1\leq n\leq 3) =\langle(1, 1), (3, 1), (10, 0)\rangle$, and rescaling to take $a_3=1, b_3=0$ we get $a_4=4, b_4=-1$; $a_5=19, b_5=-9$; $a_6=105, b_6=-73$; $a_7=662, b_7=-616$; etc. Unfortunately, I also can't find any references to this series, and the OEIS doesn't seem to be any help.
