Numbers of the form $n!+1$ are quite often prime numbers. Is there any formula $f(n)$ such that the probability that $f(n)$ is prime approaches 1 as $n$ goes to infinity and $f(n)$ also approaches infinity?

If not, is there some formula better then $n!+1$ ?

Is there any formula $g(n)$ such that: the number of times $g(n)$ is prime for $0<n<M$, divided by $M$, does not approach 0 as $M\to\infty$?

  • $\begingroup$ g(n) = nth prime number works :) [as Andre' notes below]. Could you limit your definition of "formula"? $\endgroup$ – barrycarter Oct 1 '11 at 4:21

Numbers of the form $n!+1$ appear to be very seldom prime. As of a few months ago, there were only $21$ known values of $n$ for which $n!+1$ is prime, with the largest known $n$ around $110000$. It is not known whether there are more than $21$. So I would not agree that $n!+1$ is quite often a prime number. There are some details and a few references here.

On the basis of the admittedly skimpy numerical evidence for $n!+1$, the simple function $f(n)=6n+1$ does far better at representing primes than $n!+1$.

For spectacular performance at small values of $n$, there is Euler's $f(n)=n^2-n+41$, which is prime for $n=1, 2, \dots, 40$. It also seems to be "often" prime afterwards. However, it has not even been shown that there are infinitely many $n$ such that $n^2-n+41$ is prime!

It might be difficult to give precise meaning to your question about whether there is a formula $g(n)$ such that $g(n)$ is prime for some "positive fraction" of the integers. The difficulty is with the term "formula." If we interpret "formula" broadly enough, there are even formulas for primes.. Most of these are, on analysis, somewhat artificial, and not at all helpful, but they are formulas.

However, things change if we are willing to allow exceptions. We can get quite natural and, most importantly, easily computable functions that generates mostly primes by minor tweaking of certain primality tests.

For instance, we can use the fact that if $2^{n-1} -1$ is divisible by $n$, then $n$ is very likely to be prime. (If $p$ is an odd prime, then $2^{p-1}-1$ is divisible by $p$. There are also non-primes $n$ such that $n$ divides $2^{n-1}-1$, but they are scarce compared to the primes.) For information about such "almost" primality criteria, please look here.

  • $\begingroup$ Why is there so few primes of the form n!+1 ? $\endgroup$ – grok_it Oct 1 '11 at 3:39
  • $\begingroup$ @grok_it Just a basic heuristic shows why we should actually expect it to not be prime. Sure, $n!+1$ is not divisible by any prime $\leq n$, but there's still many primes $ n < p \leq \sqrt{n!+1} $ to have a crack at it. That second interval becomes many, many times larger, and some rough estimation with Stirling's approximation and the Prime Number Theorem shows there are exponentially more primes in the second interval than the first. In general, it's quite lucky for a huge number to be prime unless it has special reason to be, which $n!+1$ doesn't$. $\endgroup$ – Ragib Zaman Oct 1 '11 at 3:49
  • $\begingroup$ I don't think anyone can give a precise answer, else we would have theorems, not conjectures. But here is an informal reason. Apart from not having primes $\le n$ as divisors, $n!+1$ seems pretty "random." But, of course, it is huge, so is unlikely to be prime. This sort of idea has been used to make informed estimates about, for example, the number of primes $\le x$ of the shape $n^2+1$. These estimates often seem to fit the facts quite well , even though, at least for $n^2+1$, there is no proof. $\endgroup$ – André Nicolas Oct 1 '11 at 3:51
  • $\begingroup$ Related discussion can be found in these two links: (1) To what extent can values of $n$ such that $n^2−n+41$ is composite be predicted? (2) Proof of no prime-representing polynomial in 2 variables. $\endgroup$ – anon Oct 1 '11 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.