Talk:Formula for primes

From Wikipedia, the free encyclopedia

Contents

[edit] Formulas that frequently produce primes

Do you know of any other formulas that produce primes so frequently?? Name some. User:66.32.255.166

Try Prime number and the section "Formulas yielding prime numbers" which has some. It is rather better than this page, so I will copy the content from there to here. --Henrygb 00:41, 7 May 2004 (UTC)

[edit] Reversion of changes by an anon

I've reverted all the changes by this anon guy. He keeps adding info to articles when it's been moved from one article to another, and he also has been deleting/altering comments on talk pages. CryptoDerk 03:14, Mar 5, 2005 (UTC)

[edit] Removal of formula

I've removed this formula as it clearly doesn't do what it is claimed to, but I cannot find a reference to fix it (the lack of a reference is itself a problem). I do hope someone can supply the corrected version Robma 11:17, 14 May 2006 (UTC)

It doesn't? It seemed to when I tried it... — vijay 18:14, 14 May 2006 (UTC)

Using MathCad it started producing composites around the n = 27 mark. But I suspect this may be due to rounding error. Either way, I still think we need a reference for this formula (I for one would be v interested to learn more about it; it's an unusually neat result for this field). Robma 21:06, 14 May 2006 (UTC)

Hrm. Around that range (excluding the 2s) I get
  • n=22 => 23
  • n=28 => 29
  • n=30 => 31
  • n=36 => 37
  • n=40 => 41
I used Java ('cause it's what I have), and of course, I used ints at first, which led to an overflow and negative output. Switching to BigInteger did the trick :-). A reference would be good, though. I put a note on the contributing editor's talk page. — vijay 22:24, 14 May 2006 (UTC)
Great stuff; thanks for confirming that. I'll get in touch with some people about getting a ref for this formula, and also the one queried below (which again is unfamiliar to me too).Robma 07:29, 16 May 2006 (UTC)

Robma, please specify which formula you are removing from the article instead of just referring to it on the talk page as "this" formula so that editors don't have to hunt through the page's history (which is easy now, but won't be so easy months in the future). Thanks! Anyway, the formula under discussion here, for the benefit of people reading this talk page, is:

f(n) = 2 + [(2 (n!))  \,\operatorname{mod} (n+1)].

I've restored it, since it seems from the above discussion and that the formula is correct, even if we still are missing a citation. The formula was originally added by User:LC to the prime number article ([1]) and then moved to this article by User:Henrygb. —Lowellian (reply) 04:46, 25 May 2006 (UTC)

Ah, ha! With a little help from a friend, here is the proof, which is rather trivial:
First, consider the case where n is one less than a prime, that is, when n = p − 1. This is equivalent to saying that the modulus n + 1 is prime. Then:
f(n) = 2 + [2n!  \,\operatorname{mod} (n+1)] = 2 + [2(p - 1)!  \,\operatorname{mod} ((p - 1)+1)]
Applying Wilson's theorem, we get:
f(n) = 2 + [2(-1)\,\operatorname{mod}\,p] = 2 + (-2\,\operatorname{mod}\,p) = 2 + (p - 2) = p
So clearly, when the modulus n + 1 is a prime p, f(n) = p, so when n + 1 is prime, f(n) ranges over all the primes.
Now, we still have to prove that when n + 1 is not prime, we get f(n) = 2. To prove this, all we need to do is show that n!  \,\operatorname{mod} (n+1) \equiv 0, since then that term drops out, leaving only the 2. We proceed to do this:
If n + 1 is not prime, then we can write n + 1 = pk, where p is the smallest prime that divides n + 1. Clearly, since p and k are both factors of n + 1, we have p < n + 1 and k < n + 1. Unless p = k, both p and k are distinct factors of the expansion n! = n \times (n - 1) \times (n - 2) \times  ... \times 1, implying that n!\,{mod}\,(pk) \equiv n!\,{mod}\,(n + 1) \equiv 0.
Now, let's take the final case, where n + 1 = pk and p = k, that is, wherein n + 1 = p2. We know p < n + 1, since p is the square root of n + 1, and 2p < n + 1, since for all integers m \ge 3, 2m < m2. Therefore, the expansion n! = n \times (n - 1) \times (n - 2) \times  ... \times 1 contains both 2p and p, so p2 | n! and n!\,{mod}\,(p^2) \equiv n!\,{mod}\,(n + 1) \equiv 0. QED.
Lowellian (reply) 04:19, 26 May 2006 (UTC)

[edit] Correct formula

I have a doubt with the formula for n-th prime, i have never seen it demonstrated i mean: --Karl-H 20:35, 15 May 2006 (UTC)


p_n = 1 + \sum_{m=1}^{2^n}  \left\lfloor \left\lfloor { n \over 1 + \pi(m) } \right\rfloor^{1 \over n} \right\rfloor.

[edit] (n+1)th

"In the Proceedings of the Indian Academy of Sciences(Math. Sci.), Vol.92, No.1,September 1983 pp 49-52, an explicit formula for the (n+1)th Prime which is the same as nth Prime as n could be substituted for n+1 for a given integer. In other words, if one wants to find the 6th Prime Number, then the integer n=5. The paper also gives a formula for the (n+1)th Twin prime which is the same as the nth Twin Prime. Further, the paper gives formulae for number of Primes and Twin Primes less than any given Prime. The proof is written in a cumbersome format to avoid plagiarism and therefore it is difficult to follow. The following are the pages of the paper. http://www.ias.ac.in/jarch/mathsci/92/00000050.pdf http://www.ias.ac.in/jarch/mathsci/92/00000051.pdf http://www.ias.ac.in/jarch/mathsci/92/00000052.pdf http://www.ias.ac.in/jarch/mathsci/92/00000053.pdf http://www.ias.ac.in/jarch/mathsci/93/00000068.pdf"

This paragraph is hard to understand. Here is my suggestion, but I haven't implemented it because I am uncertain that my reformulation replicates the meaning of the original.

"In the Proceedings of the Indian Academy of Sciences(Math. Sci.), Vol.92, No.1, September 1983 pp 49-52, an explicit formula for the nth prime number is given. The paper also gives a formula for the nth twin prime. Further, the paper gives formulae for the number of primes and twin primes less than any given prime. The proof is written in a cumbersome format to avoid plagiarism and therefore it is difficult to follow. The following are the pages of the paper. http://www.ias.ac.in/jarch/mathsci/92/00000050.pdf http://www.ias.ac.in/jarch/mathsci/92/00000051.pdf http://www.ias.ac.in/jarch/mathsci/92/00000052.pdf http://www.ias.ac.in/jarch/mathsci/92/00000053.pdf http://www.ias.ac.in/jarch/mathsci/93/00000068.pdf"--Dougall 07:47, 14 July 2006 (UTC)

The entire section is quite useless. I'm sufficiently new to Wikipedia to hesitate to delete it, but I wish that someone would.
I also hesitate to include a reference to my paper, "Formulas for primes" by Underwood Dudley (Mathematics Magazine 56 (1983), 17-22), but having it in the article would be nice, too.
The previous unsigned comment was added by Ddunx46135 00:30, 21 November 2006 (UTC), and reformatted by me for clarity. PrimeHunter 01:15, 21 November 2006 (UTC)

[edit] Concerning the paper of Venu Atiyolil

I am going to note that the mentioned formula has a running time of at least seeking out the next prime and trial dividing in any practical case.