Factoring $3^6-3^3 +1$ $3^6-3^3 +1$ factors?, 37 and 19, but how to do it using factoring, $3^3(3^3-1)+1$, can't somehow put the 1 inside  

$x^2-x+1$ factorises as $(x-\omega)(x+\omega^2)$ where $\omega^3=-1$.
Here $x=27$ and working modulo $27$ the cubes are $1,8,0,10,17,0,19,26, 0, 1, 8 \dots$ so $8^3\equiv -1$, and we can take $\omega = 8, \omega^2=64\equiv 10$ and obtain the factorisation $$(27-8)(27+10)=19\times 37$$
Since we have a cube root involved and the modulus is a power of $3$ there are some curiosities about the factorisation, but it checks out all the same.
