<s>[INST] If $a^3b-ab^2$ is divisible by $3$ then either $a$ is divisible by $3$ or $b$ is divisible by $3$ or $(b-1)$ is divisible by $3$ Question:
Prove for all integers $a,b$ that if $a^3b-ab^2$ is divisible by $3$ then either $a$ is divisible by $3$ or $b$ is divisible by $3$ or $(b-1)$ is divisible by $3$
Attempt:
Suppose by contradiction that $3 \nmid a$ and $3 \nmid b$ and $3 \nmid (b-1)$,
Then $a^3b-ab^2=(a)(b)(a^2-b)$, and so since $3$ is prime by Euclid's lemma we have
$3|a$ or $3|b$ or $3|(a^2-b)$, but by assumption $3 \nmid a$ and $3 \nmid b$ so then
$3|(a^2-b)$
Now since $3 \nmid a$ and $3 \nmid b$ and $3 \nmid b-1$ then there exists some integers $k,j$ with
$a = 3k+1$ or $a=3k+2$ and $b=3j+1$
Here is where I am not sure how to continue, Consider
$a^2-b \mod 3 \equiv 9k^2+6k+1 - (3j+1) \equiv 0 \mod 3$ or
$a^2-b \mod 3 \equiv 9k^2+12k+4 - (3j+1) \equiv 0 \mod 3$
where now I can't seem to find a contradiction. I think I have made a small mistake somewhere along the way but I can't seem to find it.
Any insights appreciated.
 [/INST] Your error is that if $3\not \mid b$ (So $b\not \equiv 0\pmod 3$) and $3\not \mid b-1$ (So $b-1\not \equiv 0 \pmod 3$ and $b\not \equiv 1 \pmod 3$ then $b \equiv 2 \pmod 3$ (and not $b \equiv 1 \pmod 3$). So $b = 3j + 2\ne 3j + 1$.
(If $b = 3k$ then $3\mid b$.  If $b = 3j+ 1$ then $3\mid b-1$.  So to have $3\not \mid b, b-1$ we must have $b= 3j + 2$.)
And then you contradiction is right in front of our eyes.
$a^2 - b = 9k^2 + \begin{cases}6k+1\\12k + 4\end{cases} - (3j+2)\equiv -1\pmod 3$.
(Minor error:  $(3k+2)^2 = 9k^2 + 12k + 4$ and not $9k^2 +6k + 4$.  But it's better to use $a\equiv -1\pmod 3; a =3k -1; (3k-1)^2 = 9k^2 -6k + 1$.)
=======
But I'd do it directly.  With Euclids lemma we have if $3|a^3b-ab^2 = ab(a^2-b)$ we must have either $3|a$ or $3|b$ or $3|a^2-b$.
If $3|a$ or $3|b$ we are done.  SO it suffices to show: Assume $3\not\mid a$ and $3\not \mid b$ then $3|a^2 -b\implies 3|b-1$.
And if $3\not \mid a$ then $a\equiv 1,2\pmod 3$ and $a^2 \equiv 1 \pmod 3$ so
So $b-1 \equiv b - a^2 \equiv -(a^2 -b)\equiv 0 \pmod 3$.
And we are done.
</s>