Prove that for any integer $n, n^2+4$ is not divisible by $7$.

since we have $$n\equiv 0,1,2,3,4,5,6\mod 7$$ we get $$n^2\equiv 0,1,2,4\mod 7$$ therefore $$n^2+4\equiv 1,4,5,6\mod 7$$


Your proof is correct (fleablood's comment). Let me rephrase a bit:

$A(n):= n^2 +4$; $B(r,q) = 7 q^2 + 2rq;$

$A(n) = 7B(r,q) + (r^2 +4)$.

Fairly simple to show that:

$A(n)$ is divisible by $7 \iff $

$(r^2 +4)$ is divisible $ n.$

By inspection

$(r^2 +4) , r = 0,1,2,3,4,5,6,$

is not divisible by $7$.

$\Rightarrow$: $A(n)$ is not divisible by $7$.


Through trial and error, we see that no valid value of r satisfies r2+4=7k

so we have proved our theorem by contradiction.

I'm pretty sure this is either wrong somewhere or at the very least not the proof that the question intended. Any help would be appreciated.

Through trial and error you did $7$ calculations. This is fine and acceptable. The calculations are not divisible by $7$ and you proved the if $n^2 +4$ were ever divisible by $7$ then $r^2 +4$ would have to be an you showed it can't. End of story. Good job.

But it's pretty unsatisfactory to do $7$ calculations off page and say "You can check them for yourselves, for now take my word for it".

Here's a slicker way of saying the exact same thing:

We need to prove that $n^2 + 4 \not \equiv 0 \mod 7$.

If $n^2 + 4 \equiv 0 \mod 7$ then $n^2 \equiv 3 \mod 7$

Now there and $7$ residue classes modulo $7$. They are $[0], [1],[2], [3], [-3]=[4], [-2]=[5],$ and $[6] =[-1]$.

So there are $7$ cases to check.

Case 1: $n \equiv 0\implies n^2 \equiv 0 \not \equiv 3 \mod 7$.

Case 2: $n \equiv \pm 1 \implies n^2 \equiv 1 \not \equiv 3 \mod 7$.

Case 3: $n \equiv \pm 2 \implies n^2 \equiv 4 \equiv -3 \not \equiv 3 \mod 7$.

Case 4: $n \equiv \pm 3 \implies n^3 \equiv 9\equiv 2 \not \equiv 3 \mod 7$.

We are done.

A little more advanced: $0 = 0; 1 = 1; 2=3-1; 3=3;$ and $4... 6 \equiv -3...-1$.

So $n \equiv \pm (3k \pm i)$ where $k,i \in \{1,0\}$

$n^2 \equiv (\pm (3k \pm i))^2 \equiv 9k^2 \pm 6ki + i^2 \equiv 2k^2 \mp ki + i^2$ which has 8 possible values depending on whether $k,i$ equal $0$ or $1$ and whether the $\pm$ is a plus or a minus.

If $k = 0$ then $n^2 \equiv i^2$ which is either $0,1$ depending on the value of $i$.

If $k = 1$ then $n^2 \equiv 2\mp i + i^2$. Which is either $2$ or $4$ depending upon the value of $i$ and the sinage of $\mp$.

But that is probably way too obtuse, isn't it?