9

What would be the immediate implications for Math (or sciences as a general) if someone developed a formula capable of generating every prime number progressively and perfectly, also able to prove (or disprove) the primality of every N-th number. I know this is a very large and subjective answer, however, I would like to know some of these implications - like the breaking of many security systems based on the primes. Moreover, there are examples of practical Math's implication, not just theoretical, of a possible prime number formula discovery? There is for example in Physics, Chemistry, Geography or Astronomy any field which would be very improved with a so great and dreamed Eureka?

3 Answers3

14

There are in fact many 'formula's which always generate prime numbers. Among the simplest ones listed by Wikipedia are:

  • There is some real number $A$ such that $\left\lfloor A^{3^n}\right\rfloor$ is always prime.
  • There is some real number $\alpha$ such that $\left\lfloor 2^{2^{\cdots^{\alpha}}} \right\rfloor$ is always prime.
  • The formula $2 + [2(n!) \bmod (n+1)]$ always gives a prime, where here '$\bmod$' (nonstandardly) denotes the remainder.

The third in particular generates every prime.

These formulas are mathematically valid, fun to prove, and highly interesting. However, they are actually completely useless, and not just because we don't know the values of $A$ and $\alpha$. So (as some have suggested in the comments) a better question is how fast one can generate primes.

The ability (or inability) to generate or check for primes in a certain amount of time is fundamentally important to cryptographic systems such as RSA. However, the "practical" applications of prime numbers (to fields like physics, chemistry, etc.) are, as far as I understand, very few -- cryptography is the major application.

  • 3
    Of course you couldn't generate the primes up to $n$ in time $O(\log n)$ since you wouldn't have time to write them down. (In decimal, this takes time $\Theta(n)$; writing out just their differences should take $\Theta(n\log\log n/\log n)$ if I'm not mistaken.) Just 'touching' each prime would take time $\Theta(n/\log n)$. – Charles May 15 '13 at 14:52
  • @Goos sorry if my question is stupid (I don't know a lot about primes) but what you are saing that is already know too, a bijection that map the naturals in to the prime numbers $p:\Bbb N \rightarrow \Bbb P$ such that $p(n)=p_n$ is the $n$-th prime numbers but is useless because it take an amount of time too high to give the result (in a uacceptable time)? – MphLee May 15 '13 at 15:10
  • 1
    @MphLee well, there is a difference in saying that such a bijection exists and being able to compute it. As you have defined it, $p: \mathbb{N} \to \mathbb{P}$ is just a function and not an algorithm. But yes, we do have algorithmic definitions for $p$ - they just take too long, as you say. (Does this make sense?) – Caleb Stanford May 15 '13 at 15:19
  • @Charles: good point. (Technically, you wouldn't have to write all of them down to generate them if you were able to express the entire set in some compact way, but nevertheless I admit I did not put thought into my $O(\log n)$ statement at all.) – Caleb Stanford May 15 '13 at 15:21
  • 1
    @Goos: Right -- you could write it in $\Theta(\log n)$ like "the primes up to 1000000", or in $\Theta(\log\log n)$ like "the primes up to 10^6" (when you're lucky enough to have a number expressible as a power of, say, 10). But this calls into question the meaning of "generate"! – Charles May 15 '13 at 19:20
  • The third formula blew my mind. Until now I was convinced that any formula for a prime has to either contain a parameter that cannot be effectively computed, or has to be immensely complicated. This one is so elegant! – Jakub Konieczny May 15 '13 at 20:19
  • 1
    How exactly does the ability to generate the $n$th prime in $O(\log n)$ time (assuming it was possible) lead to a break of RSA? – Thomas Mar 23 '15 at 09:51
  • @Thomas I think that's probably a silly statement to make, so I removed it. If you're more knowledgeable on the topic, feel free to edit. – Caleb Stanford Mar 24 '15 at 06:59
  • I don't think the generation of primes is important for RSA. Even if you can list all the prime numbers up to some $\sqrt n$ in constant time, that does not help you to factorize $n$ (I guess the method you think of is simply to try all the factors). In RSA for example, $n$ could be of the order of $2^{4096}$, and even knowing all the primes up to $2^{2048}$ by heart wouldn't help. Furthermore, checking if a number is prime is polynomial in the logarithm of said number, so I don't understand what you mean by "the ability to check for primes". – zarathustra Mar 24 '15 at 07:26
  • I don't quite get the second formula. It's tetration, correct? Isn't it then a constant function? The alpha coefficient can simply be equal to 1 and it will always produce primes - namely the number 2. – Pythagoras of Samos Nov 23 '15 at 22:19
  • @Devdalus yes, it's tetration. But it isn't constant for any value of alpha. It grows quite quickly. For alpha=1 you get 2, 4, 16, 65536, ... – Caleb Stanford Nov 23 '15 at 22:31
  • I mean that the second expression as a whole is constant for every value of n (contrary to the remaining 2 equations), because obviously it does not consider n at all – Pythagoras of Samos Nov 23 '15 at 22:35
  • Oh. Well I thought it was clear that the ...s is meant to indicate a chain of n 2s. If you want to edit in a \underbrace, do feel free! – Caleb Stanford Nov 23 '15 at 22:37
  • I am still somewhat confused. So is it like $({^{n}2})^\alpha$ ? The formula is interesting though, is it described in more detail somewhere? – Pythagoras of Samos Nov 23 '15 at 23:03
  • 1
    @Devdalus That notation looks right--it is $\left(\underbrace{2^{2^{\cdots^2}}}_{n \text{ twos}}\right)^\alpha$. I couldn't find a reference for the formula, though I'm sure I read it on wikipedia or somewhere, a few years back. Anyway, you can prove it with Bertrand's postulate. – Caleb Stanford Nov 24 '15 at 05:28
8

As others have mentioned there are many formulas for primes.

I can't pass up the opportunity to mention my favorite:

$$p_n=1+\sum^{2^n}_{m=1}\left\lfloor \sqrt[n]n \left( \sum^{m}_{x=1}\left\lfloor \cos^2\left( \pi \frac{(x-1)!+1}{x}\right) \right\rfloor \right)^{-1/n} \right\rfloor$$

Maybe it's just my favorite because it's so complicated and unwieldy!

I first found the formula in Hacker's Delight by Warren. The formula is cited as "Willan's Formula". The formula can be derived from the fact that $(x-1)!\equiv -1 (\mod x)$ iff x is 1 or prime. So if $((x-1)!+1)/x$ is an integer, $x$ is prime (or 1), so the cosine of this times $\pi$ will be -1 or 1 iff $x$ is prime or 1. $\cos^2$ gets rid of the negative, floor keeps only the values for which the $\cos^2$ is 1.

This formula appears to be described on the mathworld page for prime formulas.

6

There are dozens, probably hundreds, of formulas for prime numbers. It's a very well-studied problem. Guy's Unsolved Problems in Number Theory has a section devoted to this, and Ribenboim's books cover this in some depth. Many formulas have been published in mathematical journals, and I've seen at least one survey paper in a journal dedicated to giving an overview of the various types of formulas for primes.

Finding a new formula for the primes might be interesting enough to be published, but not in a first-rate journal unless there's something special about it.

As for security concerns, what would be much more important would be a way to solve integer factorization quickly -- say, in polynomial time. (At the risk of verbosity, this means the time needed to factor $n$ is less than $(\log n)^k$ for some fixed $k$.) Proving that a number is prime can already be done in polynomial time, see the famous AKS algorithm (or the more practical ECPP).

Charles
  • 32,122