<s>[INST] Primes in the form $n^2+4$ For what numbers $n$ is $n^2+4$ prime?

Obviously $n$ has to be odd number (if $n$ is even, then $n^2+4>2$ is also even, so it couldn't be a prime number).
So far I recognize that the latest digit of $n$ is not 9 and 1, because then $n^2\equiv 1 \pmod{5}$, so $n^2+4\equiv 0 \pmod{5}$.
Unfortunately, that's all I get so far. I checked that if $n\in\{1,3,5,7,13,15,17\}$, then $n^2+4$ is prime, but for $n=23$ we have
$$n^2+4=23^2+4=529+4=533=13 \cdot 41,$$
so $23^2+4$ is not a prime number.
 [/INST] A partial result is that if $n>1$ is itself a square, then $n^2+4$ will not be a prime.  For if $n=m^2$ then:
$$n^2+4=m^4+4=(m^2+2m+2)(m^2-2m+2)$$
and since $m=\sqrt{n}>1$ both factors will be $>1$.
Also, if $n=ax+b$ with $a>1$ and $b^2+4=ka$ for some $k$, then $n^2+4$ will not be a prime since:
$$n^2+4=(ax+b)^2+4=a^2x^2+2abx+(b^2+4)= a(ax^2+2bx+k)$$
For example if $a=5$ the condition is satisfied by $b=1$ or $4$ which correspond (with $a$ even and odd respectively) to your observation that $n^2+4$ will not be prime when the last digit of $n$ is $1$ or $9$.  Other examples satisfying the condition are:
$\qquad n=13x+3$ and $n=13x+10$
$\qquad n=17x+8$ and $n=17x+9$
$\qquad n=29x+5$ and $n=29x+24$
</s>