TITLE: On Euler's polynomial $x^2+x+41$
QUESTION [47 upvotes]: This is an elementary question about something way outside my area of expertise.  A well-known observation due to Euler is that the polynomial $P(x)=x^2+x+41$ takes on only prime values for the first 40 integer values of $x$ starting with $x=0$, namely the values $41,43,47,53,61,71,83,\cdots,1601$.  In particular this gives a rather long sequence of primes such that the differences between successive terms form an arithmetic progression, namely $2,4,6,\cdots$, which is a consequence of $P(x)$ being quadratic.  All this is related to the fact that the discriminant of $x^2+x+41$ is $-163$ and the field ${\mathbb Q}(\sqrt{-163})$ has class number 1.
Suppose one asks about the next 40 values of $P(x)$ after the value $P(40)=41^2$.  We have $P(41)=1763=41\cdot 43$, also not a prime.  After this the next two values $P(42)=1847$ and $P(43)=1933 $ are primes.  Then comes $P(44)=2021=43\cdot 47$, then four primes, then $P(49)=2491=47\cdot 53$, then six primes, then $P(56)=3233=53\cdot 61$, then eight primes, then $P(65)=4331=61\cdot 71$, then ten primes, then $P(76)=5893=71\cdot 83$. The next four values are prime as well for $x=77,\ 78,\ 79,\ 80$, completing the second forty values. But then the pattern breaks down and one has $P(81)=6683=41\cdot 163$.  Thus, before the breakdown, not only do we get sequences of $2,\ 4,\ 6,\ 8,\ 10$ primes but the non-prime values are the products of two successive terms in the original sequence of prime values $41,\ 43,\ 47,\ 53,\ 61,\  \cdots$.  There is a simple explanation for this last fact, the easily-verified identity $P(40+n^2)=P(n-1)P(n)$, so when $n=1,2,3,\cdots$ we get $P(41)=P(0)P(1)=41\cdot 43$, $P(44)=P(1)P(2)=43\cdot47$, etc.  However, this does not explain why the intervening values of $P(x)$ should be prime.  
I've done an online search to find where this might be discussed, without success, so my question is, what is a reference for this curious behavior of the second 40 values of $P(x)$ (or anything related)? I'm also a little puzzled by the identity for $P(40+x^2)$, though perhaps it comes from the norm function in ${\mathbb Q}(\sqrt{-163})$.

REPLY [2 votes]: Please check my post.
It indicates that the number of divisors of $x^2+x+41$ is equal to the number of lattice points of $X^2+163Y^2-2(2x+1)Y-1=0$.
This formula is transformed in this way.
$$163X^2+163^2Y^2-2\cdot163(2x+1)Y=163$$
$$163X^2+\{163Y-(2x+1)\}^2-(2x+1)^2=163$$
$$163X^2+(163Y-2x-1)^2=4x^2+4x+164$$
$X':=163Y-2x-1,\ Y':=X$ and we divide both sides by 4,
$$\frac{{X'}^2+{163Y'}^2}{4}=x^2+x+41=P(x)$$

$$N\left(\frac{X'+Y'\sqrt{-163}}{2}\right)=P(x)$$

$\frac{X'+Y'\sqrt{-163}}{2}$ is an element of $\mathbb Q(\sqrt{-163})$.
This formula indicates that the elements of $\mathbb Q(\sqrt{-163})$ with norm $P(x)$ is linked to the product pattern of two integers of $P(x)$.
The phenomenon you are interested in is based on this fact.
For example, let $x$ be $76$.
\begin{eqnarray*}
    P(x)&=&76^2+76+41\\
    &=&1\cdot5893\\
    &=&71\cdot83
\end{eqnarray*}
The number of product pattern of $P(x)$ is $2$.
On the other hand, the elements of $\mathbb Q(\sqrt{-163})$ with norm $P(x)$ (ignore sign) are
$$\frac{153+\sqrt{-163}}{2},\ 5+6\sqrt{-163}\ .$$
The number is $2$.
The left one is a trivial element $\frac{(2x+1)+\sqrt{-163}}{2}$.The other one is a non-trivial element that indicates that $P(x)$ is a composite number.