Proof. Given that p divides a^2, so that means that:
\begin{align*} p \mid a^2. \end{align*}
\begin{align*} a = \prod_{i = 1}^{n} p_i^{m_i}. \end{align*}
\begin{align*} p \mid (\prod_{i = 1}^{n} p_i^{m_i})^2 \iff p \mid \prod_{i = 1}^{n} p_i^{2m_i} \end{align*}
\begin{align*} p \mid \prod_{i = 1}^{n} p_i^{m_i} \iff p \mid a, \end{align*}