Diophantine equation: choosing the right modulus to prove an equation cannot be satisfied I was looking at this problem, which asks to show that there are no $m,n \in \mathbb Z$ such that
$$3n^2+3n+7 = m^3.$$
The result follows immediately from considering the equation modulo $9$ and enumerating the possibilities. But what if we somehow missed $9$ and instead considered other moduli? In other words, we would be aiming to find a $k \in \mathbb Z$ for which the sets $\{3n^2 + 3n + 7:n\in\mathbb Z\}$ and $\{m^3:m\in\mathbb Z\}$ are disjoint modulo $k$, thereby proving the impossibility of finding such $m,n$.
I've looked through all $k \in [2, 5000]$, and the winners are precisely the multiples of $9$. Why is this so?
The main question I have is this:

Is it true that $\{3n^2 + 3n + 7:n\in\mathbb Z\}$ and $\{m^3:m\in\mathbb Z\}$ are disjoint modulo $k$ if and only if $k \equiv 0 \pmod 9$?

 A: Here's a sketch. For all but finitely many primes $p$, your equation gives rise to an elliptic curve $\bmod p$. To see this very explicitly, rewrite it as
$$81n^2 + 81n + 27 \cdot 7 = 27m^3$$
and substitute $z = 9n, x = 3m$ to get
$$z^2 + 9z + 27 \cdot 7 = x^3.$$
Now complete the square to get
$$\left( z + \frac{9}{2} \right)^2 = x^3 - 27 \cdot 7 + \frac{81}{4} = x^3 - \frac{3^3 \cdot 5^2}{2^2}.$$
Substituting $y = z + \frac{9}{2}$ produces an elliptic curve $\bmod p$ for all primes $p$ except possibly $p = 2, 3, 5$. 
The Hasse-Weil bound implies that when $p \neq 2, 3, 5$ this curve has at least $p - 2 \sqrt{p}$ points on it, so for all primes $p \ge 7$ there is a solution $\bmod p$. (This is the least trivial step in the argument, and it really uses the fact that we have an elliptic curve and not just some polynomial.) Using Hensel's lemma will allow us to lift these to solutions $\bmod p^k$, and using the Chinese remainder theorem gives us solutions $\bmod n$ where $n$ isn't divisible by $2, 3, 5$. 
Now the only moduli left to investigate are powers of $2, 3, 5$. For $2$ and $5$ you can find solutions by hand and use Hensel's lemma, which leaves only $3$. 
