Identity for $f(x) = \sum_{k=1}^{n}(x+k)^2$ I have a function $$f(x)=(x+1)^2+(x+2)^2 + \dots + (x+n)^2 = \sum_{k=1}^{n}(x+k)^2$$
for some positive integer $n$. I started wondering if there is an equivalent expression for $f(x)$ that can be calculated more directly (efficiently).  
I began by expanding some terms to look for a pattern.
$$
(x^2+2x+1) + (x^2+4x+4) + (x^2+6x+9) + (x^2+8x+16) + \dots 
$$
By regrouping the $x^2$, $x$, and constant terms, I can see that
$$
f(x) = \sum_{k=1}^{n}x^2 + \sum_{k=1}^{n}2kx + \sum_{k=1}^{n} k^2
$$
for which I've found some identities to get
$$
f(x) = n x^2 + n(n+1)x + \frac{1}{6}n(n+1)(2n+1)
$$
and simplifying some (attempting to make it computationally efficient)
$$
f(x) = n \left[ x^2 + (n+1)x + \frac{1}{6}(n+1)(2n+1) \right]
$$
$$
f(x) = n \left[ x^2 + (n+1) \left( x + \frac{2n+1}{6} \right) \right]
$$ 

Is this a particular type of summation (maybe just exponential?), and if so is there a standard way to write it?
  Along those lines, is there a more direct derivation than what I've attempted here, perhaps using an identity I don't know?


Given the identity:
$$ \sum_{k=1}^n k^2 = \frac{n(n+1)(2n+1)}{6}$$
Write
$$ \sum_{k=1}^{n}(x+k)^2 = \sum_{k=x+1}^{n+x}k^2 = \sum_{k=1}^{n+x}k^2 - \sum_{k=1}^{x}k^2$$
$$ \sum_{k=1}^{n}(x+k)^2 = \frac{(n+x)(n+x+1)(2n+2x+1)}{6} - \frac{x(x+1)(2x+1)}{6}$$
Which reduces to:
$$ \sum_{k=1}^{n}(x+k)^2 = n \left[ x^2 + (n+1) \left( x + \frac{2n+1}{6} \right) \right]$$
