Quadratic equation has integral roots 
Find all positive numbers $p$ for which the equation $x^2+px+3p = 0$ has integral roots.

We have by the quadratic formula $$x = \dfrac{-p \pm \sqrt{p^2-12p}}{2}.$$ Thus, $p^2-12p = p(p-12)$ must be a perfect square. How do we continue?
 A: Alternatively, if $m,n \in \mathbb{Z}$ are the roots, then we have $m+n=-p, mn = 3p$ so that $3(m+n)+mn = 0 \implies (m+3)(n+3) = 9, m,n \le 0$ From this we get $\{(0,0), (-6,-6), (-12,-4) \}$ as the possible roots. This gives the values of $p$ as $\{0,12,16\}$
A: HINT:
Let $p^2-12p=(p-q)^2$  where $q$ is any integer
$\implies\dfrac{q^2}{2(q-6)}=p$  which is an integer
Clearly, $q$ must be even $=2r$(say)
$$p=\dfrac{r^2}{r-3}=\dfrac{(r-3+3)^2}{r-3}=r-3+2\cdot3+\dfrac{3^2}{r-3}$$
If $p>0, q>6\implies r>3$
A: Let $a,b$ be the integer roots. Then by Vieta's formulas:
$$
\begin{align}
a + b = -p \tag{1} \\
ab = 3p \tag{2}
\end{align}
$$
By $(2)$ the roots must have the same sign, and by $(1)$ they must be both negative. If $p=0$ then the trivial solution is $a=b=0\,$, otherwise dividing $(1) / (2)\,$:
$$
\frac{1}{a}+\frac{1}{b} = -\frac{1}{3} \quad \iff \quad \frac{1}{(-a)}+\frac{1}{(-b)} = \frac{1}{3}
$$
The above gives another trivial solution $a=b=-6 \iff p=12\,$, otherwise it reduces to the problem of expressing the unit fraction $\cfrac{1}{3}$ as the sum of two distinct unit fractions $\cfrac{1}{(-a)}+\cfrac{1}{(-b)}$. The latter is (related to egyptian fractions, and is) known to have a unique solution since $3$ is a prime (see this for example), which is $a=-4,b=-12$ in this case, giving $p=16$.
Summing up the subcases listed above, $p \in \{0, 12, 16\}\,$.
