<s>[INST] Polynomial division challenge Let $x,y,n \in \mathbb{Z} \geq 3$, Find $A,B$ such that $$x^{n-1}+x^{n-2}y+x^{n-3}y^2+\cdots+x^2y^{n-3}+xy^{n-2}+y^{n-1}= A(x^2+xy+y^2)+B$$ What is the best method to approach this? 
 [/INST] As we have homogeneous polynomials, we first solve the problem for the de-homogeneised polynomials, setting $y=1$, then homogeneise the results.
So we have to  find  $A, B$ such that 
\begin{align*}
& x^{n-1}+x^{n-2}+x^{n-3}+\cdots+x^2+x+1= A(x^2+x+1)+B \\
\iff (&x-1)(x^{n-1}+x^{n-2}+x^{n-3}+\cdots+x^2+x+1)=A(x-1)(x^2+x+1)+B(x-1)\\
\iff\vphantom{(} & x^n-1=A(x^3-1)+B(x-1)
\end{align*}
Now let $r=n\bmod 3$. It is easy to check the quotient and the remainder of the division of $x^n-1$ by $\,x^3-1\,$ are: 
$$ A=x^{n-3}+x^{n-6}++\cdots+x^r, \quad B = x^r -1. $$
Hence, for the original problem with homogeneous polynomial, we'll have:
$$A=x^{n-3}+x^{n-6}y^3++\cdots+x^ry^{n-3-r},\quad B=x^ry^{n-3-r}-y^{n-3}. $$
</s>