<s>[INST] If $a$ and $b$ are integers such that $9$ divides $a^2 + ab + b^2$ then $3$ divides both $a$ and $b$. If $a$ and $b$ are integers such that $9$ divides $a^2 + ab + b^2$ then show that $3$
divides both $a$ and $b$.

can anyone tell me please how to solve these types of problem oe which formula is required
 [/INST] Starter: Since $a^3-b^3=(a-b)(a^2+ab+b^2)$, and by Fermat'little theorem, we conclude that, under our condition, $a\equiv b\pmod 3$.
Suppose the contrary: $a, b$ are relatively prime to $3$. So $a=3k\pm1, b=3l\pm1$. Then $a^2=9k^2\pm6k+1$,
$b^2=9l^2\pm6l+1$,
$ab=9kl\pm3(k+l)+1$.
Summing together, we find: $a^2+ab+b^2=9(k^2+l^2+kl\pm k\pm l)+3$, which is not divisible by $9$, a contradiction. Therefore $a$ and $b$ are both divisible by $3$.
If any mistakes are presented, tell me. Thanks in advance.  
</s>