<s>[INST] Solve for $x^2 + 7x +1 = 3n(x^2 + x +1), n \in \Bbb{Z}$ Solve for $x$ and $n$ in the equation
$$ \dfrac{x^2 + 7x +1}{ x^2 + x +1}= 3n,\qquad n \in \Bbb{Z}.$$
The original problem was a trigonometric equation but solved it till I got stuck here. I am a  high school student who is self studying and preparing for college entrance exam. Original problem was a trigonometric equation which came from 'cengage exam crack'.
[After Mark's and Jyrki's hints in the comments, I got the answer and posted it below.]
Original problem:

 [/INST] $3n
=\dfrac{x^2 + 7x +1}{ x^2 + x +1}
$
so
$3nx^2+3nx+3n
=x^2+7x+1
$
so
$(3n-1)x^2+(3n-7)x+3n-1
=0
$
or
$\begin{array}\\
x
&=\dfrac{-3n+7\pm \sqrt{(3n-7)^2-4(3n-1)^2}}{2(3n-1)}\\
&=\dfrac{-3n+7\pm \sqrt{(3n-7-2(3n-1))(3n-7+2(3n-1))}}{2(3n-1)}\\
&=\dfrac{-3n+7\pm \sqrt{(-3n-5)(9n-9)}}{2(3n-1)}\\
&=\dfrac{-3n+7\pm 3\sqrt{(-3n-5)(n-1)}}{2(3n-1)}\\
\end{array}
$
If nothing is specified about $x$,
this is as far as we can go.
If $x$ has to be real,
then
$(3n+5)(n-1) \le 0$
so that
$-\dfrac53 \le n \le 1$.
Since $n$  is an integer,
$n = -1, 0, 1$.
If $x$ is supposed to be rational,
then
$(3n-7)^2-4(3n-1)^2
=m^2
$.
From the preceding result,
$n=1
\implies
m^2
=4^2-4(2)^2
=0
$,
$n=0
\implies
m^2
=7^2-4(1)^2
=45
$,
$n=-1
\implies
m^2
=10^2-4(-4)^2
=36
$.
Therefore the only rational solutions
with integer $n$ are
$n=1, 0, -1$
for which
$n=1
\implies x
=\dfrac{-3n+7\pm 3\sqrt{(-3n-5)(n-1)}}{2(3n-1)}
=\dfrac{4}{4}
=1
$,
$n=0
\implies x
=\dfrac{-3n+7\pm 3\sqrt{(-3n-5)(n-1)}}{2(3n-1)}
=\dfrac{7\pm 3\sqrt{5}}{-2}
$,
and
$n=-1
\implies x
=\dfrac{-3n+7\pm 3\sqrt{(-3n-5)(n-1)}}{2(3n-1)}
=\dfrac{-10\pm 4}{-8}
=\dfrac{-14, -6}{-8}
=\dfrac74, \dfrac52
$.
</s>