# Does $n^2+(n+k)^2+(n+2k)^2+ \ldots +(n+mk)^2$ have a general equation?

Does $n^2+(n+k)^2+(n+2k)^2+\ldots+(n+mk)^2$ have a general formula?

e.g.

$$1^2+2^2+3^2+\ldots+n^2=n(n+1)(2n+1)/6$$

-
The sum can we written as $\sum_{j=0}^m(n+jk)^2=\sum_{j=0}^mn^2+2jkn+j^2k^2$ and using the formulas $\sum_{j=0}^mj=\frac{m(m+1)}2$, $\sum_{j=0}^mj^2=\frac{m(m+1)(2m+1)}6$, we get \begin{align*}\sum_{j=0}^m(n+jk)^2&=(m+1)n^2+knm(m+1)+k^2\frac{m(m+1)(2m+1)}6\\ &=(m+1)\left(n^2+knm+\frac{k^2m(2m+1)}6\right). \end{align*}