<s>[INST] Divisibility rules with prime number Let $n \in \mathbb{Z}$ with the property that
$$
7 \mid\left(n^{3}+1\right)
$$
but $7$ does not divide $\left(n^{2}-2 n-3\right) .$ Prove that $7 \mid(4 n+1)$.
So far I got:
$n^3+1 = (n+1)\cdot(n^2-n+1)$, since $7$ is a prime, so
$7\mid(n+1)$ or $7\mid(n^2-n+1)$.
And since $7$ does not divide $\left(n^{2}-2 n-3\right) = (n-3)\cdot(n+1)$, I know that $7\mid(n^2-n+1)$.
And $7$ does not divide the difference of $(n^2-n+1)$ and $(n^2-2n-3)$ which is $n+4$.
Same since $7$ is prime, $7$ does not divide $4n+16\Rightarrow$$7$ does not divide $4n+2$.
Then I am stuck here, how could I use the information I got so far to prove $7 \mid(4 n+1)$?
Really hope someone could help/hint me with it! Thank you!
 [/INST] Further factor $n^2 - n + 1 \equiv (n - 3)(n - 5) \mod 7$. Since $n - 3 \neq 0 \mod 7$, we see that $n - 5 \equiv 0 \mod 7$. So $n \equiv 5 \mod 7$. So $4n + 1 \equiv 0 \mod 7$.
</s>