\(m^3+n^3+p^3-3mnp=\left(m^3+3m^2n+3mn^2+n^3\right)+p^3-3mnp-3m^2n-3mn^2=\left(m+n\right)^3+p^3-3mn\left(m+n+p\right)\)
\(=\left(m+n+p\right)\left[\left(m+n\right)^2-\left(m+n\right)p-p^2\right]-3mn\left(m+n+p\right)\)
\(=\left(m+n+p\right)\left(m^2+2mn+n^2-mp-np-p^2\right)-3mn\left(m+n+p\right)\)
\(=\left(m+n+p\right)\left(m^2+2mn+n^2-mp-np-p^2-3mn\right)\)
\(=\left(m+n+p\right)\left(m^2+n^2+p^2-mn-np-mp\right)\)