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.
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: