Show that there is no perfect square whose last three digits are 341.
Solution: Let x be any integer. Note that if $x^2$ ended with the digits 341, then we would have $$x^2 = 1000k+341$$ for some integer k, so $$x^2 = 1000k + 341 = 341 = 5 (mod 8)$$. We make a table of squares modulo 8.
$$ x: 0, 1, 2, 3, 4, 5, 6, 7$$ $$ x^2: 0, 1, 4, 1, 0, 1, 4, 1 $$
From the table we see that $$x^ 2 = (0, 1,4) mod 8$$ Thus $x^2$ cannot end with the digits 341.
My problem with this solution is that i do not know i am supposed to know to take mod8 of 100k+341. I tried doing it with mod 4 and I get that $$x^2 = 1000k + 341 = 341 = 1 (mod 4)$$
but the table of mod 4 shows me that $$ x: 0, 1, 2, 3, 4, 5, 6, 7$$ $$ x^2: 0, 1, 0, 1, 0, 1, 0, 1 $$
So in this case it would be possible that mod 4 of $x^2$ = 1
please help me clarify this in my mind