Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've passed by this article:

and this paper:

They say that there is a formula such that when you give it (n) then it returns the n-th prime number. Where other articles states that no formula discovered so far that does such thing.

If the formula exists indeed, then why from time to time they discover a new largest prime number known ever. It would be very simple using the formula to find a larger one.

I just want to ensure whether such formula exists or not.

share|cite|improve this question
Actually, most of these "formulas" are based on Sieve theory. – Shane Chern Mar 17 '13 at 8:40
up vote 2 down vote accepted

As you already mention yourself: it doesn't make sense to keep on looking for prime numbers with computer algorithms if there is a prime number equation.

Looking at the formulas on the site you provided, it seems to me that the formulas are really just an algorithm which allows you to determine whether some number is a prime number based on the previously found prime numbers. That I could already do in highschool by just checking whether a number can be divided by the previous prime numbers with integer solution (larger then 1). Probably, I cannot judge that quickly, the algorithm is more efficient then what I mention, but it still not a 'plug in the numbers and have your answer with a pocket calculator'.

share|cite|improve this answer

It depends on what you mean by "formula". Certainly no formula is known such that using it to find a new very large prime would be "very simple".

share|cite|improve this answer

If formulae for computing primes existed, there wouldn't be a a thing called 'Largest known primes' . And moreover, there are few primes like Mersenne primes and Fermat Prime. But eventually, their converse isn't true ALWAYS.

For eg: Mersenne Prime.

$q$ is $prime$ which is equal to $2^p-1$, this shows $p$ is a prime. But the converse, take a prime $a$, it is always not true that $2^a-1$ is a prime.

Similarily for the Fermat primes. So, there are no thing called 'Formula' to find primes.

share|cite|improve this answer

Well there have been a # of functions developed all of which-I believe-have started at 1 & gone up. The problem is: they are sloooooow! If it takes l000 steps to obtain all primes up to #7 ... well! The thing about them though is they show weird relationships to other things: One uses pentagonal #s; one only pi & e; & I found a relationship between primes & the Fibonacci #s.So they are fascinating to mathematicians.

Now, I just took a look at Kaddoura's formula in the website you gave. I'm impressed that he appears to be giving exactly what you are asking for. You can now see what the key Q is: how fast is it, assuming it works. But he gives us a way to check: the Mathematica info to run it. Most people do not have it; so connect up with a local University & befriend a grad student!

We might at least imagine K's formula to be faster than E's sieve, but we can ck it. Possibly it's faster for a lower n, but not for higher; but who knows?

Another big Q for you is what range of #s you are interested in. Oh, say you are around 10^6=1,000,000 & your function-with a certain computer-takes 3 secs to solve f(n). Then we estimate it will take 1,000,000 times as long to find f(n) for 10^12. Modern problems related to cryptography were in the range of 10^150 ten yrs ago(for the product of 2 primes) & have steadily increased. To give you an idea, there are 10^80th protons in the universe. And 10^150 is 10^70 times larger!

Note that the commentator, on the other site mentioned, claimed it a threat wrt cryptography. Totally not, unless it can deal with very, very large #s.

OK! lets' just suppose K's formula gives f(n) quickly for any #, no matter how large. In that case it could bust certain old ones because of their structure. RSA, of course, would immediately change such in defense. It would probably also necessitate an increase in n. And that would increase times for coding & decoding. Offhand I would not expect a serious increase.

Hamzeh, I hope this has helped.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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