Saturday, August 3, 2013

The difference between two (consecutive) prime numbers

Recall that
The Continuous derivative method of finding a formula for the estimated difference between two prime numbers
Applying the Product Rule for differentiating functions, P'(n) , the derivative of Prime(n),
is ~= α(n.1/n + 1.log n) = α( 1 + log n )
Yes, the derivative is usually for continuous functions, while Prime[n] is discrete, but approximating this way is OK because it's useful. 
What the derivative means is: let Δ be a reasonably small value, then P(n+Δ) ~= P(n) + Δ.P'(n)
This implies that if we want P(n+1), we may put Δ=1 above and the (n+1)th prime number is approximately P(n) + P'(n), i.e. just add α( 1 + log n )  to the nth prime number.
Got it?
The (n+1)th prime number, note α around 1.1
What is this useful for? 
We've already seen that we may estimate the prime numbers with so-so results using the formula for the nth prime.
But we may sometimes get closer approximations when we seek a prime number, the (n+1)th prime for instance, using the difference formula and prior knowledge of the nth prime.   

If we know the 99th prime number to be 523, what is the 100th prime?
Add 1.2(1+log99) to 523 , to get 523+6.714 ~= 530.
Oh well, this is not a prime number and it's still pretty far from the 100th prime (541), but the formula works better sometimes,
e.g. the 101st prime, given the 100th prime is 541 is
estimated to be 541+1.2(1+ln100) = 541 + 6.726 ~= 547.7
and in actual fact is 547

The finite/discrete derivation of the formula for the estimated difference between two consecutive primes
This yields similar/close results to the continuous derivative steps above:
P[n+1] - P[n] ~= α.(n+1).log(n+1) - α.n.logn
 = α [ n.log(n+1) + log(n+1) - n.log(n) ] 
 = α [ log ( (n+1)^n ) - log (n^n) + log (n+1) ] 
=  α [ log ( {(n+1) / n}^n . (n+1) ) ]
= α [ log {(1 + 1/n)^n .(n+1)} ] 
and at this point, you need the fact that (1+ 1/n)^n is approximately e, which has log 1, for reasonably large n.  For example (1+1/5)^5 is about 2.5, while 1.01^100 is about 2.7.  Anyway, moving on...
so P[n+1] - P[n] ~= α.log(e.(n+1)) = α.[1+log(n+1)] 

What should be done about the difference between the continuous and the discrete formulae?
Ignore the fact that the difference has 1+log(n+1) here, but 1+log(n) in the first derivation.
We might have even chosen to use the derivative at n+1/2Δ instead of at n as we did, and got the difference P[n+1] - P[n] ~= α.[1+log(n+ 1/2)]   
Anyway, when n>>1, log(n) is very close to log(n+1) in the sense that it's much smaller than 1 and much smaller than n: how to see this is another short exercise in using the derivative :) i.e. the derivative of log(n) is 1/n which is << 1 << n

Answers to two previous questions
 1. How does one know that there is no largest PRIME number?  Because when we think we've found the biggest, here is an estimate for the next one...add 1+log(n+1) to it. 
2. How do you know if α > 1?  Sorry I thought I knew, but I don't (yet.) 


  1. Correction: Obviously meant "Applying the Product Rule..." NOT "Applying the Chain Rule" in the first paragraph.

  2. Comment on "no largest prime number"
    Even the "proof" here is not very good.
    Why do I say this?
    Well, we started with a graph that gave the hint that Prime[n] looks like n log n at least on the range of n that we computed and plotted (probably n from 1 to a few million). We determined the difference or derivative formula based on that. Now we want to assume that this holds for n up to an arbitrarily large value.
    But we have no guarantee that Prime[n] continues to follow the difference formula forever. That said, it would be surprising if the behaviour of Prime[n] suddenly became very different for larger values of n.

    How to repair this situation?
    If only we could show that α has a lower limit, say 1, or even any non-negative value, then we could seal our argument. And we can, I promise. I'll just need a new, so-called analytic proof.


My Other Blogs

  • #Glocal #business #news bits - With these types of forums (Breakfast chats with seasoned founders and CEOs), we can share our experiences and fast track our growth - Deji Akinyanju (Fo...
    11 hours ago
  • Prizes - Top of the top: 10 Nobel Laureates Who Changed The World See all the Nobel Prizes. Advertisement: Read my books. - [image: Nobel Prizes in Physics,...
    2 days ago
  • Who Will You Marry? Answer in the comments :) - Really good quiz here, you answer 10 questions and it reveals 'who is the right person for you' :) I want to know what result you got, so comment. And ...
    5 days ago
  • o O ~ circles ~ O o - Want REALbubbler Membership? Want fine African Literature? (Preview) Nigerian Lifestyle A-Z at
    2 weeks ago
  • Paradise Road - It was a morning like any other morning, on a road like any other road. 8 a.m. “Conductor, give me my change.” The dust, smoke, and everything were ma...
    4 weeks ago

About Me