# Some hints for "If a prime $p = n^2+5$, then $p\equiv 1\mod 10$ or $p\equiv 9\mod 10$"

I tried to prove this question by first considering the possible last digit of $p$ when $p=n^2+5$, but that reasoning got me nowhere. Then I tried to prove it by contrapositive, and however I just couldn't really find where to start.
Hence I'm here asking for some hints (only hints, no solution please).

Many thanks,
D.

• Think about $n^2+5\pmod2$ and $n^2+5\pmod5$. I think this will help. Jan 27 '16 at 19:45
• Well, n = 0 is one exception.... Jan 27 '16 at 19:48
• oh, sorry. Forget to mentioned that in here the $n\in\mathbb{N}\backslash\{0\}$ Jan 27 '16 at 19:54
• I'm not super familiar with the notation for modular arithmetic, but is this equivalent to saying $p\equiv\pm1\mod 10$?
– Paul
Jan 28 '16 at 2:12

Consider the last digits of squares, so $n^2$, these are $0,1,4,5,6,9$.

From there you get the last digits of $n^2 +5$.

Now, drop those from the list that cannot be the last digit of a prime.

• Ok, I did tried it with this way as I mentioned. However, I can't prove for that 1 or 9 must work, I did eliminate the rest. Jan 27 '16 at 19:52
• What do you mean "$1$ or $9$ must work?" It is not true that if $p\equiv 1\pmod{10}$ then $p=n^2+5$. @DeanY Jan 27 '16 at 19:54
• @DeanY You do not have to prove that "1 or 9 must work". Indeed as said in the comment above it is not even quite clear what that woudl mean; But there are examples of such primes, that you can exhibit for illustration such as $6^2 + 5 = 41$ is prime and ends in $1$. And you'll also find one that ends in 9.
– quid
Jan 27 '16 at 19:55
• Oh, so I did kind of proved it? But I'm a bit confused here. My understanding of the question is that if a prime satisfies that property, then either the last digit must be 1 or 9. Jan 27 '16 at 19:57
• Ok, I see. Thank you for your patience. My brain kind of stroke on his question. Jan 27 '16 at 20:05

Hint: The possible values of $n^2$ (mod $10$) are $0, 1, 4, 5, 6, 9$. Which ones can you eliminate since $n^2 + 5$ is not prime?

$n^2=0,1, 4,9,6,5$ mod $10$ so $n^2+5= 6,9,4,1,0,5$ mod 10. If $n^2+5$ prime, it is odd and not divisible by 5 the result follows. so you can only have $n=1, 9$ mod 10

• "only hints, no solution please" Jan 27 '16 at 19:49
• Thank you for the help, but I really did ask for ONLY hint. Jan 27 '16 at 20:00