The $n$th Fermat number $F_n$ is defined as $F_n = 2^{2^n}+1$. The first five Fermat numbers, $F_0,F_1,F_2,F_3,F_4$, are all prime. Why is this?
It seems like a fairly surprising coincidence that all five of these are prime. The prime number theorem predicts that the density of prime numbers near $m$ is about $1/\log m$. Therefore, as a crude heuristic, we expect that $F_n$ has about a $1/\log F_n$ "probability" of being prime (if it behaved like a random number of that size). Now
$${1 \over \log F_1} \times {1 \over \log F_2} \times {1 \over \log F_3} \times {1 \over \log F_4} \approx {1 \over 281}.$$
So, it seems like a rather unexpected coincidence that all of these should be prime. I know there are some weaknesses in this argument, but even after them, it still feels suggestive that perhaps there is something deeper going on.
Is there an explanation why this fact (that the first five Fermat numbers are prime) is not as surprising as it might first seem? For instance, are there some additional properties of Fermat numbers that make them "more likely" to be prime than a random number of that size? (Perhaps the set of possible divisors is restricted to a much smaller set than for a general number, and this affects the density?)
I see a comment arguing that the heuristic is inaccurate for small numbers. But that's not what I find when I try some examples. For instance, let's compute $f(m)$, the fraction of numbers in the range $[m/\sqrt{2},\sqrt{2}m)$ that are prime. We find $f(5) = 0.5$ and $f(17)=0.33$ and $f(257)=0.16$, whereas the heuristic gives $1/\log 5 = 0.62$ and $1/\log 17 = 0.35$ and $1/\log 257 = 0.18$. Pretty close. (The interval $[m/\sqrt{2},\sqrt{2}m)$ is arbitrarily chosen to be approximately centered around $m$ and to have the upper value be about twice the lower value; but it can be replaced with any other reasonable choice without appreciably changing the result.) So this "crude heuristic" is actually quite accurate even for small numbers, and can't be the explanation for the situation.
Or, let me put it another way. Suppose I replace the crude heuristic above with a more accurate estimate, where I use $f(m)$ as the density of prime numbers near $m$. Here $f(m)$ is calculated empirically as shown above, not by any asymptotic estimate relying upon the prime number theorem. Now through calculation I find
$$f(5) \times f(17) \times f(257) \times f(65537) \approx 0.5 \times 0.33 \times 0.16 \times 0.09 \approx {1 \over 405}.$$
So the explanation is not failure of the prime number theorem to apply to small numbers. Indeed, if we use exact estimates rather than asymptotic estimates, it still appears to be a somewhat surprising coincidence that all of $F_0,\dots,F_4$ are prime, if we assume that the Fermat numbers behave like random numbers of a similar size.
Of course, the most obvious explanation is that Fermat numbers probably don't behave like random numbers of a similar size, when it comes to the "probability" of being prime -- perhaps they are "more likely" to be prime than a random number of a similar size. But my question is: Is this so, and if so, why? Is there some deeper phenomenom that explains why Fermat numbers are "more likely" to be prime than a random number of a similar size, and if so, what is that?