Find all integers $n$ such that $(n - 1)^2 + 3$ divides $n^3 + 2023$.

Problem: Find all integers $$n$$ such that $$(n - 1)^2 + 3$$ divides $$n^3 + 2023$$.

My Work:

$$(n - 1)^2 + 3 = n^2 - 2n + 4$$, which is always greater than 0 for all integers n.

Therefore, if $$n^2 - 2n + 4$$ divides $$n^3 + 2023$$, then $$n^3 + 2023 >= n^2 - 2n + 4$$. We can also introduce an integer k into this, but we get left with $$n^3 + 2023 = k * (n^2 - 2n + 4)$$.

After getting this inequality and equation, I am not really sure how to continue. I would really appreciate some help! Thank you so much!

• Write $n^3+2023 = (n^2-2n+4)(n+2)+2015$. Then you need $2015$ to be a multiple of $n^3+2023$, which will only happen if $n$ is negative and not very large in magnitude.
– mcd
Commented May 15, 2023 at 4:54
• List the positive divisors of $2015 : \{1,5,13,31,65,155,403,2015\}$. When you subtract $3$, only one of these divisors is a perfect square. Commented May 15, 2023 at 5:43
• @mcd, don't we need $2015$ to be a multiple of $(n-1)^2+3$? Commented May 15, 2023 at 6:19
• @Lozenges you don't even need the explicit factors. Since $2015=5×13×31$ all factors must end in $1,3,$ or $5$ and subtracting $3$ to get $(n-1)^2$ gives a terminal digit of $8,0,$ or $2$. Only $0$ is consistent with a square and that requires another preceding $0$, so $(n-1)^2+3=13×31$ is the only viable candidate. Commented May 15, 2023 at 9:48
• Yes, @Gerry Myerson of course.
– mcd
Commented May 15, 2023 at 16:51

As written above, $$n^3+2023=(n^2-2n+4)(n+2)+2015$$ so you need $$2015=((n-1)^2+3)k$$ for some integer $$k$$. Since $$k$$ must divide $$2015$$, we have $$\pm k\in\{1, 5, 13, 31, 65, 155, 403, 2015\}$$ (see the comments; you also formally probably need the negative ones). However, since $$(n-1)^2+3>0$$, we must have $$k>0$$, so $$\frac{2015}k\in\{1, 5, 13, 31, 65, 155, 403, 2015\}$$ $$|n-1|\in \{\sqrt{1-3}, \sqrt{5-3}, \sqrt{13-3}, \sqrt{31-3}, \sqrt{65-3}, \sqrt{155-3}, \sqrt{403-3}, \sqrt{2015-3}\}=\{\sqrt{-2}, \sqrt{2}, \sqrt{10}, \sqrt{28} ,\sqrt{ 62} ,\sqrt{ 152} ,20 ,\sqrt{ 2012}\}$$ where only one is an integer (see the comments too) so since $$n$$ must be an integer we get $$|n-1|=20$$, i.e. $$n=21$$ or $$n=-19$$.