X^8+X^7+1
=X^8+X^7+X^6-X^6+1
=X^6(X^2+X+1)-(X^6-1)
=X^6(X^2+X+1)-(X^3+1)(X^3-1)
=X^6(X^2+X+1)-(X^3+1)(X-1)(X^2+X+1)
=(X^2+X+1)[X^6-(X^3+1)(X-1)]
=(X^2+X+1)(X^6-X^4+X^3-X+1)
X^8+X^7+1
=X^8+X^7+X^6-X^6+1
=X^6(X^2+X+1)-(X^6-1)
=X^6(X^2+X+1)-(X^3+1)(X^3-1)
=X^6(X^2+X+1)-(X^3+1)(X-1)(X^2+X+1)
=(X^2+X+1)[X^6-(X^3+1)(X-1)]
=(X^2+X+1)(X^6-X^4+X^3-X+1)