# Polynomial as a sum of simply factored expressions?

The polynomial

```
p^9 + p^8 + 7*p^6 + 6*p^4 + 3*p^3 + 4*p^2 + 2
```

can't be factored (over the rationals). However, it can be expressed in simpler form as

```
(p^3+1)^3 + (p^2+1)^4
```

Is there any way (other than trial and error) of finding such a sum, for a given (multivariate) polynomial?