18. 已知等差数列 $\left\{a_{n}\right\}$ 中, $a_{3} a_{7}=-16, a_{4}+a_{6}=0$, 求 $\left\{a_{n}\right\}$ 的前 $n$ 项和 $S_{n}$.
设 $\left\{a_{n}\right\}$ 的公差为 $d$, 则

$\left\{\begin{array}{l}\left(a_{1}+2 d\right)\left(a_{1}+6 d\right)=-16, \\ a_{1}+3 d+a_{1}+5 d=0,\end{array}\right.$

即 $\left\{\begin{array}{l}a_{1}^{2}+8 d a_{1}+12 d^{2}=-16, \\ a_{1}=-4 d .\end{array}\right.$

解得 $\left\{\begin{array}{l}a_{1}=-8, \\ d=2,\end{array}\right.$ 或 $\left\{\begin{array}{l}a_{1}=8, \\ d=-2 .\end{array}\right.$

因此 $S_{n}=-8 n+n(n-1)=n(n-9)$,

或 $S_{n}=8 n-n(n-1)=-n(n-9)$.