Lời giải:
a) $x+3=(x+3)^2$
$\Leftrightarrow (x+3)^2-(x+3)=0$
$\Leftrightarrow (x+3)(x+3-1)=0$
$\Leftrightarrow (x+3)(x+2)=0$
$\Rightarrow x+3=0$ hoặc $x+2=0$
$\Rightarrow x=-3$ hoặc $x=-2$
b)
$n^2-4n-15\vdots n+2$
$\Leftrightarrow n(n+2)-6(n+2)-3\vdots n+2$
$\Leftrightarrow 3\vdots n+2$
$\Rightarrow n+2\in\left\{\pm 1;\pm 3\right\}$
$\Rightarrow n\in\left\{-3; -1; 1; -5\right\}$