0

There are lots of formulas, like $f(n) = n^2 + n + 41$, that generate lots of primes very often. But they're not guaranteed to always generate only prime numbers.

Do there exist any simple/efficient formulas $f(n)$ that are guaranteed to generate a sequence of only prime numbers for each $n$? Or has it been proven that such a formula can't exist?

To be clear, I don't want a trivial formula like $f(n)=7$ (which technically always produces only prime numbers). And it has to be decently simple/efficient, meaning that things like Willans' Formula don't count.

chausies
  • 2,160
  • 1
    Yes, it is proved that a polynomial $f\in \Bbb Z[x]$ producing only primes is constant, see this post. But for polynomials in $26$ variables it is possible. – Dietrich Burde Oct 22 '22 at 16:51
  • 2
    "Jones, Sato, Wada, and Wiens have also found a polynomial of degree 25 in 26 variables whose positive values are exactly the prime numbers (Flannery and Flannery 2000, p. 51)." – Dietrich Burde Oct 22 '22 at 16:59
  • @DietrichBurde That's amazing! I had no idea that was possible. This MO post states the polynomial, as well as links to their paper, for anyone interested. – Theo Bendit Oct 22 '22 at 17:13
  • It's not clear what you want. It seems that you want a way to generate primes, and that it must be a formula or expression. Willans's formula is exactly a way to generate the primes, translated into the language of a mathematical formula, and so would seem to be exactly what you are after, yet you say that it doesn't count... – Rosie F Oct 22 '22 at 17:13
  • It is even worse. We know no efficient method to construct ANY not already known large prime number. We can only sieve out small prime factors followed by a primality test to find one. – Peter Oct 22 '22 at 17:47
  • The few known examples of prime generating formulas are useless in practice. – Peter Oct 22 '22 at 17:49

1 Answers1

2

Not really, no. Indeed, the first sentence of the "Formulas for primes" section of the Wikipedia page is "There is no known efficient formula for primes." I recommend clicking on the "Main article: Formula for primes" for further information.

To prove that "such a formula" doesn't exist, one would first need to rigorously define the class of formulas one is interested in.

Greg Martin
  • 78,820