x^3-9x^2+27x-27
=x^3-27-(9x^2-27x)
=(x-3)*(x^2+3x+9)-9x(x-3)
=(x-3)(x^2+3x+9-9x)
=(x-3)(x^2-6x+9)
=(x-3)(x-3)^2
=(x-3)^3