<s>[INST] Find all integers $n$ such that $\frac{3n^2+4n+5}{2n+1}$ is an integer. Find all integers $n$ such that $\frac{3n^2+4n+5}{2n+1}$ is an integer.
Attempt:
We have
\begin{equation*}
\frac{3n^2+4n+5}{2n+1} = \frac{4n^2+4n+1 - (n^2-4)}{2n+1} = 2n+1 - \frac{n^2-4}{2n+1}.
\end{equation*}
So, we must have $(2n+1) \mid (n^2-4)$, so $n^2-4 = k(2n+1)$, for some $k \in \Bbb Z$. But, I did not be able to find $n$ from here.
Any ideas? Thanks in advanced.
 [/INST] First way: Using the Extended Euclidean Algorithm in $\Bbb Q[x]$.
Notice that
\begin{equation*}
15 = 4(3n^2+4n+5) - (6n+5)(2n+1).
\end{equation*}
Hence, if $2n+1$ divides $3n^2+4n+5$, then it also divides $15$.
Thus, $2n+1 \in \{\pm 1, \pm 3, \pm 5, \pm 15\}$, i.e.,
\begin{equation*}
n \in \{-8,-3,-2,-1,0,1,2,7\}.
\end{equation*}
Second way: Just using the Elementary number theory.
From your approach, we have
\begin{equation*}
\frac{3n^2+4n+5}{2n+1} = \frac{4n^2+4n+1 - (n^2-4)}{2n+1} = 2n+1 - \frac{n^2-4}{2n+1}.
\end{equation*}
Now, let $k=2n+1$, then $2n \equiv -1 \pmod{k}. \ldots (1)$
We want $(2n+1) \mid (n^2-4)$, i.e., $n^2-4 \equiv 0 \pmod{k}. \ldots (2)$
Multiplying both side in $(2)$ by $4$, we have
\begin{align*}
4n^2 - 16 \equiv 0 \pmod{k} &\Leftrightarrow (2n)^2 - 16 \equiv 0 \pmod{k} \\
&\Leftrightarrow (-1)^2 - 16 \equiv 0 \pmod{k} \qquad \qquad (\text{by $(1)$}) \\
&\Leftrightarrow -15 \equiv 0 \pmod{k}.
\end{align*}
Hence, $2n+1 \mid 15$. Thus, $2n+1 \in \{\pm 1, \pm 3, \pm 5, \pm 15\}$, i.e.,
\begin{equation*}
n \in \{-8,-3,-2,-1,0,1,2,7\}.
\end{equation*}
Now, we are done.
</s>