Sum of the square harmonic series I stumbled across the following series reviewing some HW from a few years ago
$\sum_{i=1}^{n}\left(\sum_{j=i}^{n}\frac{1}{j}\right)^2$
i.e.
$(\frac{1}{1}+\frac{1}{2}+\ldots+\frac{1}{n})^2+(\frac{1}{2}+\ldots+\frac{1}{n})^2+\ldots+(\frac{1}{n})^2$
This series equals $2n-\sum_{i=1}^{n}\frac{1}{i}$, which I have confirmed with some code.  I am curious if anyone can give a hand in trying to show this relation.  So far, writing $\sum_{i=1}^{n}\frac{1}{i}$ as $S_n$, I have rewritten the sum as
$S_n^2+(S_n-S_1)^2+(S_n-S_2)^2+\ldots +(S_n-S_{n-1})^2$
But have been stuck at dead ends using this approach.  Any thoughts or hints would be greatly appreciated.
 A: We want to evaluate the triple sum
$$
\sum_{i = 1}^n \sum_{j, k = i}^{n} \frac{1}{jk}
=
\sum_{j, k = 1}^{n} \frac{\min\{j,\,k\}}{jk}.
$$
We can proceed inductively. If $n=0$, this is $0=\left.2n-S_n\right|_{n=0}$. If we increment from $n=m$ to $n=m+1$, the sum needs to increase by $(2m+1)/(m+1)$. Indeed it increases by$$\sum_{j=1}^{m+1}\frac{1}{m+1}+\sum_{k=1}^{m+1}\frac{1}{m+1}-\frac{1}{m+1},$$where the last term prevents double-counting of the new case $j=k=m+1$.
A: Proof by induction. For $n = 1$ it is easy to show that this holds. Assume the induction hypothesis for some $n$. Then we want to show that
$$
\sum_{p = 1}^{n + 1} \biggl( \sum_{q = p}^{n + 1} \frac{1}{q} \biggr)^2
\;=\;
2 (n + 1) - \sum_{p = 1}^{n + 1} \frac{1}{p}
\text{.}
$$
We have
$$
\biggl( \sum_{q = p}^{n + 1} \frac{1}{q} \biggr)^2
\;=\;
\biggl( \sum_{q = p}^{n} \frac{1}{q} + \frac{1}{n + 1}\biggr)^2
\;=\;
\biggl( \sum_{q = p}^{n} \frac{1}{q} \biggr)^2 + \frac{2}{n + 1} \sum_{q = p}^{n} \frac{1}{q} + \frac{1}{(n + 1)^2}
$$
and so
$$
\sum_{p = 1}^{n + 1} \biggl( \sum_{q = p}^{n + 1} \frac{1}{q} \biggr)^2
\;=\;
\sum_{p = 1}^{n} \biggl( \sum_{q = p}^{n + 1} \frac{1}{q} \biggr)^2
+
\frac{1}{(n + 1)^2}
\;=\;
\sum_{p = 1}^{n} \biggl( \sum_{q = p}^{n} \frac{1}{q} \biggr)^2
+
\frac{2}{n + 1} \sum_{p = 1}^n \sum_{q = p}^n \frac{1}{q}
+
\frac{1}{n + 1}
.
$$
Here the last double sum equals
$$
\sum_{p = 1}^n \sum_{q = p}^n \frac{1}{q}
\;=\;
\sum_{q = 1}^n \sum_{p = 1}^q \frac{1}{q}
\;=\;
\sum_{q = 1}^n 1
\;=\;
n.
$$
Now using our assumption, we find
$$
\sum_{p = 1}^{n + 1} \biggl( \sum_{q = p}^{n + 1} \frac{1}{q} \biggr)^2
\;=\;
\sum_{p = 1}^{n} \biggl( \sum_{q = p}^{n} \frac{1}{q} \biggr)^2
+
2
-
\frac{1}{n + 1}
\;=\;
2 n + 2
-
\sum_{p = 1}^{n} \frac{1}{p}
-
\frac{1}{n + 1}
$$
which equals what we wanted to show.
