Sum of elements in the nth set of the sequence of sets of squares $\{1\}$, $\{4,9\}$, $\{16,25,36\}$, ... Let $S_n$ denote the sum of the elements in the $n^{th}$ set of the sequence of sets of squares: $\{1\}$, $\{4,9\}$, $\{16,25,36\}$, $\{49,64,81,100\}$,.... i.e. $S_1 = 1$, $S_2 = 13$, ... How do you find a formula for $S_n$? 
Note: this is from Koshy, Elementary Number Theory 2nd Edition, problem set 1.3, ex 45.
Thanks in advance.
 A: Yours are
$$\{1^2\},\{2^2,3^2\},\{4^2,5^2,6^2\},\{7^2,8^2,9^2,{10}^2\},\cdots.$$
So, the first element of the $n$-th set will be $i^2$ such that
$$i=1+\sum_{k=1}^{n-1}k=1+\frac{(n-1)n}{2}=\frac{n^2-n+2}{2}.$$
Hence, 
$$S_n=\sum_{k=(n^2-n+2)/2}^{((n^2-n+2)/2)+n-1}k^2=\sum_{k=1}^{((n^2-n+2)/2)+n-1}k^2-\sum_{k=1}^{((n^2-n+2)/2)-1}k^2.$$
Here, you can use
$$\sum_{k=1}^{p}k^2=\frac{p(p+1)(2p+1)}{6}.$$
A: Can you compute the sum of $n$ consecutive squares $\sum_{i=x}^y i^2$? Can you figure out a closed form for the first square in your groupings?
A: The last number squared in the $k$th group is the $k$th triangular number $t(k)=k(k+1)/2$. So the sum of squares in the $k$th group is obtained by using the sum of the first $n$ squares formula $s(n)=n(n+1)(2n+1)/6$ and computing $s(p(k))-s(p(k-1).$ This gives
$$\frac{k(3k^4+7k^2+2)}{12}.$$
A: If you compute S1 being the sum of squares from 1 to (m-1) and S2 being the sum of squares from 1 to n and substract S1 from S2, you have the sum of squares from m to n and the formula is then simply    
(m (-1 + (3 - 2 m) m) + n (1 + n) (1 + 2 n)) / 6
A: Our task is to calculate $$S_n=\sum_{i=0}^{n-1}(x+i)^2$$
where $x=\frac{n(n-1)}{2}+1$
The general formula for calculating the sum of $k$ consecutive squares is well-known to be
$$\mathcal{S}_k=\frac{k(k+1)(2k+1)}{6}$$
In terms of $\mathcal{S}_n$, $S_n$ is
\begin{align*}
S_n&=\mathcal{S}_{x+n-1}-\mathcal{S}_{x-1}\\
&=\frac{1}{6}[k(k+1)(2k+1)-r(r+1)(2r+1)]
\end{align*}
where $k=x+n-1=(n^2+n)/2$ and $r=x-1=(n^2-n)/2$
