Exercise 4.1.3
It's not hard to show that n must have the form pa2 for some
odd prime p and odd a. [Use Thm 4.5 or the corollary.]
To see that n and p are congruent modulo 8, examine the difference n -
p = p(a2 - 1) = p(a - 1)(a + 1). Note the last two
factors are consecutive even numbers. What can you conclude about
this product based on this observation?