Question 695485
Let {{{ f(x)=x^2-(p+2)x-p^2+4p+8 }}}
By the remainder theorem {{{ x-p }}} is a factor of {{{ f(x) }}} if and only if {{{ f(p)=0 }}}

So  {{{ f(p)=0 }}} implies:
{{{ p^2-(p+2)p-p^2+4p+8  = 0 }}}
{{{ p^2 - p^2 - 2p -p^2 + 4p + 8  = 0 }}}
{{{ 2p -p^2 + 8  = 0 }}}
{{{ p^2 -2p -8 = 0 }}}
{{{ (p-4)(p+2) = 0 }}}
Giving {{{ p=4 }}} or {{{ p=-2 }}}

Check:
======
When p=4 we expect {{{ x-4 }}} to be a factor:
{{{ f(x)=x^2-(4+2)x-4^2+(4)(4)+8  = x^2 -6x + 8 = (x-4)(x-2) }}}
so {{{ x-4 }}} is a factor

When p=-2 we expect {{{ x-(-2) = x+2 }}} to be a factor:
{{{ f(x)=x^2-(-2+2)x-(-2)^2+(4)(-2)+8 = x^2 - 4 = (x+2)(x-2) }}}
so {{{ x+2 }}} is a factor