TITLE: For which rationals $x$ is $3x^2-7x$ an integer?
QUESTION [5 upvotes]: The following exercise is from [Birkhoff and MacLane, A Survey of Modern Algebra]:

For which rational numbers $x$ is $3x^2-7x$ an integer?  Find necessary and sufficient conditions.

I think I was able to obtain the set of rationals $x$, but I am not sure what the necessary and sufficient conditions are about.   Here is what I tried: Suppose $3x^2-7x=k, k \in \mathbb{Z}$.  Solving the quadratic, we get $x=\frac{7 \pm \sqrt{49+12k}}{6}$, whence $49+12k$ must be the square of some integer $m$.  Now $m^2 \equiv 49 (\operatorname{mod} 12)$ has solutions $m = 1,5,7,11 (\operatorname{mod} 12)$, i.e. $m \in \{1,5,7,11\}+12 \mathbb{Z}$.  Thus, the set of rationals $x = \frac{7 \pm m}{6}$ is $\{0,\frac{1}{3} \}+\mathbb{Z} = \{\ldots,0, \frac{1}{3}, 1, \frac{4}{3}, \ldots \}$. Is this correct?  What do the necessary and sufficient conditions refer to?

REPLY [3 votes]: Your solution is correct, but here is a perhaps simpler one.
Write $x=u/v$ with $u$, $v$ coprime integers and $v>0$. Then $3x^2-7x$ is an integer iff $v^2$ divides $3u^2-7uv$. This implies that $v$ divides $3u^2$. Since $u$ and $v$ are coprime, we get that $v$ divides $3$, that is, $v=1$ or $v=3$.
When $v=1$, $x$ is an integer, no surprises there.
When $v=3$, we get that $9$ divides $3u^2-21u$ and so $3$ divides $u^2-u=u(u-1)$. Since $u$ and $v=3$ are coprime, we get that $3$ divides $u-1$, that is, $u=1+3t$ and $x=t+1/3$, with $t$ an arbitrary integer.
This coincides with your solution, of course.