Who found the expression $n^2 - n + 41 $ for generating prime numbers? I am doing some research and I cannot seem to find the answer anywhere so does anyone know who found the expression $n^2 - n + 41 $ for generating prime numbers?
 A: 
Euler first noticed (in 1772) that the quadratic polynomial
  $$
    P(n) = n^2 + n + 41
$$
  is prime for all natural numbers less than 40.

from Wiki:Formula for primes
A: As others have noted, Euler, in 1772 published this result in a very similar form (see @draks... answer). 
Note however, that he published the quadratic $n^2+n+41$, not $n^2-n+41$. 
My contribution: 
This result was stated in Nouveaux Mémoires de l'Académie royale des Sciences. Berlin, p. 36, 1772, by L. Euler.
A: Some context, the polynomial $n^2 + n + 41$ is prime for $0 \leq n \leq 39.$ It cannot possibly be prime for $n=40$ or $n=41$ because $n^2 + n + 41$ is then divisible by $41$ but larger than $41.$
It is a simple result, that $n^2 + n + k$ can only represent such a large initial sequence of primes, $0 \leq n \leq k-2,$ when both $k$ and $4k-1$ are prime. Furthermore, Rabinowitz, 1913, given those conditions, showed this happens if and only if the class number of discriminant $-(4k-1)$ is one. I give a proof of this at  Is the notorious $n^2 + n + 41$ prime generator the last of its type?
Later,
https://en.wikipedia.org/wiki/Stark%E2%80%93Heegner_theorem
this was shown to be the last time this happens.
A: It's Euler who first found it. He mentions that formula in 1771 in a letter to Bernoulli. The relevant passage is shown below, in particular the second paragraph: 

My translation:

$\qquad$ The biggest prime number that we know of is without doubt $\mathfrak{2^{31}-1=2137483647}$, which Fermat assured to be prime, $\mathfrak{\&}$ I also proved that; because this formula will never admit other divisors other than one $\mathfrak{\&}$ or the other of these $\mathfrak{2}$ forms $\mathfrak{248n+1\ \& \ 248n+63}$, I have examined all prime numbers contained in these two formulas until $\mathfrak{46339}$, and none was found to be a divisor.
$\qquad $ This progression $\mathfrak{41.\ 43.\ 47.\  53.\  61.\  71.\  83.\  97.\  113.\  131\ \, \& \rm c.}$ whose general term is $\mathfrak{41+  }x\mathfrak{+}xx$, is as much remarkable since the $\mathfrak{40}$ first terms are all prime numbers.

