<s>[INST] Is there a way to create a summation function for this? I have an algorithm that generates terms as follows:
$$\begin{align*}
\text{Term 1}: &2\times 3\times\left(\frac{1}{2}+\frac{1}{3}\right) + 4\\
\text{Term 2}: &2\times 3\times 4\times\left(\frac{1}{2}+\frac{1}{3}+\frac{1}{4}\right) + 3\times 5\\
\text{Term 3}: &2\times 3\times 4\times 5\times\left(\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\frac{1}{5}\right) + 3\times4\times 6\\
\text{Term 4}: &2\times 3\times 4\times 5\times 6\left(\frac{1}{2}+\frac{1}{3}+\frac{1}{4}+\frac{1}{5}+\frac{1}{6}\right) + 3\times4\times 5\times 7
\end{align*}$$
and so on.
The pattern in the first half is obvious; the pattern in the second half is a little trickier. It "splits" the last multiplier into (multiplier-1)*(multiplier+1) so 4 changes into 3*5 and then the 5 on that one changes into 4*6 and so on for the next term.
I am trying to find a clever way to say "sum terms 1-N" given this pattern
 [/INST] Term $k$ is $$(k+2)!(H_{k+2}-1)+\frac12(k+1)!(k+3)\;,$$ where $H_k$ is as usual the $k$-th harmonic number, $\sum_{i=1}^k\frac1k$, so the sum of the first $n$ terms is $$\sum_{k=1}^n\Big((k+2)!(H_{k+2}-1)+\frac12(k+1)!(k+3)\Big)\;.$$ You may of course replace $\frac12(k+1)!(k+3)$ by $\dfrac{(k+3)!}{2(k+2)}$ if you wish.
Added: Come to think of it, $n!H_n=\left[{n+1}\atop 2\right]$, a Stirling number of the first kind, so this can also be written $$\begin{align*}\sum_{k=1}^n\left(\left[{k+3}\atop 2\right]-(k+2)!+\frac{(k+3)!}{2(k+2)}\right)&=\sum_{k=1}^n\left(\left[{k+3}\atop 2\right]-\frac{(k+1)(k+1)!}2\right)\;.
\end{align*}$$
</s>