This question already has an answer here:
I was playing around with numbers the other day and realized that the first few values for $n(n - 1) + 1$ are prime. Now, I also quickly realized that not all values are prime ($n = 5$ results in 21, which is not prime), but I also noticed that all of the values for which the formula doesn't result in a prime are odd. I wrote up a quick python script, and since checking $n < 100,000,000$ hasn't provided an even counterexample, I was wondering if I could somehow prove or disprove the hypothesis that, for all even $n$, $n^2 - n + 1$ is prime.
I am aware of Goldbach's proof (mention of it) that for any polynomial, not all of its outputs can be prime, but I don't think that applies if the input is restricted to to just even integers.
Python 3.6.7 code I used:
from math import sqrt from itertools import count, islice n=0 m=100000000 q=0 p=1 j=0 for n in islice(count(1), m): if (n % 2): p = 0 else: q = n * (n - 1) + 1 p = n > 1 and all(n % j for j in islice(count(2), int(sqrt(n) + 1))) if (p): print(n, p)
Link to source of method of checking primality.