Solution (source code)

= Solution

Taking <determinants> of $A^p=0$ gives $(\det A)^p=0$, so $A$ is singular and has the <eigenvalue> zero. More strongly, if $Av=\lambda v$ with $v\neq0$, then $0=A^pv=\lambda^pv$, so \b[every <eigenvalue> is zero].

If the <nilpotent matrix> were <diagonalizable>, write $A=PDP^{-1}$. Then $0=A^p=PD^pP^{-1}$, hence each diagonal entry of $D$ has zero $p$th power and is zero. Thus $D=0$ and $A=0$. Conversely the zero <matrix> is diagonal. Therefore
$$
\boxed{A^p=0:\quad A\text{ diagonalizable}\iff A=0.}
$$
The conclusion is valid over $\mathbb C$ and also over $\mathbb R$.