\[a_{n} = 3n + 2;\]
\[a_{1} = 3 + 2 = 5;\]
\[a_{2} = 3 \cdot 2 + 2 = 8;\]
\[d = a_{2} - a_{1} = 8 - 5 = 3.\]
\[S_{5} = \frac{2a_{1} + 4d}{2} \cdot 5 =\]
\[= \left( a_{1} + 2d \right) \cdot 5 = (5 + 6) \cdot 5 =\]
\[= 55.\]
\[S_{40} = \frac{2a_{1} + 39d}{2} \cdot 40 =\]
\[= \left( 2a_{1} + 39d \right) \cdot 20 =\]
\[= (10 + 117) \cdot 20 =\]
\[= 127 \cdot 20 = 2540.\]
\[S_{k} = \frac{2a_{1} + d(k - 1)}{2} \cdot k =\]
\[= \frac{2 \cdot 5 + 3 \cdot (k - 1)}{2} \cdot k =\]
\[= \frac{(10 + 3k - 3)}{2} \cdot k =\]
\[= \frac{7 + 3k}{2} \cdot k.\]