Prime number p is either odd or 2.
Odd squared number equals 1 modulo 4, and 1007 is -1 mod 4, so A is divisible by 4. This means it has at least 6 divisors: 1, 2, 4, A/4, A/2, A.

If p equals 2, 1011 (=4+1007=3*337), has exactly 4 factors, 1, 3, 337, 3*337.

Thus, p=2 is the only valid answer.

Comments: (
You must be logged in to post comments.)