I proved this by taking cases for different remainders and using modular arithmetic, when the prime is $3$.However this method won't give a general proof for all primes.I was eager to get a proof for all primes $p$, but i couldn't get one.I have seen in Pythagorean triples that if both $a$ and $b$ are not divisible by $p$, $c=a^2 + b^2$ is also not, but how do i prove it?
Proving by contradiction may help...maybe induction. Also we can try proving for all numbers. of the form $6n+1$ and $6n-1$ so that it becomes evident for all primes.
The question changed and now is about proving that for all primes equivalent to $3 \bmod 4.$