How can I calculate $\sum_{k=1}^n (3k-1)^{2}$? I was trying to calculate the sum
$$\sum_{k=1}^n (3k-1)^2,$$
but actually I cannot frame the type. In fact is neither a geometric series, because the terms are not raised to the $k$th power, nor harmonic.
Any suggestions?

Let $\displaystyle  f(k)=Ak^3+Bk^2+Ck+D$ where $A,B,C,D$ are arbitrary constants
$\displaystyle\implies f(k+1)-f(k)=A\{(k+1)^3-k^3\}+B\{(k+1)^2-k^2\}+C\{(k+1)-k\}$$\displaystyle=A(3k^2+3k+1)+B(2k+1)+C$
$\displaystyle\implies f(k+1)-f(k)=3Ak^2+k(3A+2B)+A+B+C$
Comparing with $\displaystyle(3k-1)^2=9k^2-6k+1,$
$\displaystyle 3A=9\implies A=3,3A+2B=-6\implies B=-\frac{15}2;A+B+C=1\implies C=\frac{11}2 $
So, we can write $\displaystyle9k^2-6k+1=f(k+1)-f(k)$ which is a Telescoping series
$\displaystyle\implies\sum_{1\le k\le n}(3k-1)^2=f(n+1)-f(1)$
$\displaystyle=A(n+1)^3+B(n+1)^2+C(n+1)+D-(A+B+C+D) $
$\displaystyle=A\{(n+1)^3-1\}+B\{(n+1)^2-1\}+Cn$
Put the values of $A,B,C$ and optionally simplify
