3.22 *If the sequence $\left\{a_{n}\right\}$ satisfies $a_{1}=c, a_{n+1}=p a_{n}+q n(p \neq 0)$, find the general term $a_{n}$.


From the given conditions, we have $a_{n}=p a_{n-1}+q(n-1), a_{n-1}=p a_{n-2}+q(n-2)$, so
$$
\begin{array}{c}
p a_{n-1}=p^{2} a_{n-2}+p q(n-2), \\
p^{2} a_{n-2}=p^{3} a_{n-3}+p^{2} q(n-3), \\
\cdots, \\
p^{n-2} a_{2}=p^{n-1} a_{1}+p^{n-2} q(1) .
\end{array}
$$

By adding all these equations (excluding $\left.a_{n-1}=p a_{n-2}+q(n-2)\right)$, we get
$$
\begin{aligned}
a_{n} & =p^{n-1} a_{1}+q(n-1)+p q(n-2)+\cdots+p^{n-2} q(1) \\
& =p^{n-1} c+\frac{q}{1-p}(n-1)+\frac{q}{(1-p)^{2}}\left(p^{n}-p\right) .
\end{aligned}
$$

Comment: The last step of summation in this problem uses the method from Problem 3.1.11.