4. Given the sequence $\left\{a_{n}\right\}$ satisfies:
$$
a_{1}=1 \text {, }
$$
$S_{n+1}=4 a_{n}+2$ ( $S_{n}$ is the sum of the first $n$ terms of the sequence $\left\{a_{n}\right\}$).
Then $a_{n}=$ . $\qquad$
4. $(3 n-1) \cdot 2^{n-2}$.

From the problem, we know
$$
\begin{array}{l}
4 a_{n+1}+2=S_{n+2}=a_{n+2}+S_{n+1} \\
=a_{n+2}+4 a_{n}+2 \\
\Rightarrow a_{n+2}=4 a_{n+1}-4 a_{n} .
\end{array}
$$

Therefore, $a_{n}=(3 n-1) \cdot 2^{n-2}$.