factorize as-much-as-you-can



Hello,

is there a way to tell maxima to factor the most it can out of

x^2+3*x*y+5*a^2+z^2+a^3

which I understand as answering this

(x+y)^2+a^2*(a+5)+x*y

If I had to define what I want in more scientific terms, that would be
?the form that would comprise the less possible symbols? directly
related to a matter of evaluation speed.

I found factorsum() but it's about inoperant for

4*p[2]*p[3]^2*q[4]^2-p[2]^3*q[4]^2-p[1]^2*p[2]*q[4]^2
                           -2*p[3]^3*q[3]*q[4]+8*p[2]^2*p[3]*q[3]*q[4]
                           -2*p[1]^2*p[3]*q[3]*q[4]
                           +10*p[1]*p[2]*q[2]*p[3]*q[4]-4*p[2]*p[3]^2*q[3]^2
                           +p[2]^3*q[3]^2+p[1]^2*p[2]*q[3]^2
                           -10*p[1]*q[1]*p[2]*p[3]*q[3]-2*q[1]*q[2]*p[3]^3
                           -4*p[2]*q[2]^2*p[3]^2+4*q[1]^2*p[2]*p[3]^2
                           +8*q[1]*p[2]^2*q[2]*p[3]-2*p[1]^2*q[1]*q[2]*p[3]
                           +p[2]^3*q[2]^2+p[1]^2*p[2]*q[2]^2-q[1]^2*p[2]^3
                           -p[1]^2*q[1]^2*p[2]

Thanks!

***

Sincerely yours,

e.m.