p3+512
Rewrite 512 as 83.
p3+83
Since both terms are perfect cubes, factor using the sum of cubes formula, a3+b3=(a+b)(a2-ab+b2) where a=p and b=8.
(p+8)(p2-p⋅8+82)
Multiply 8 by -1.
(p+8)(p2-8p+82)
Raise 8 to the power of 2.
(p+8)(p2-8p+64)
(p+8)(p2-8p+64)
Factor p^3+512