result of my prime counting function

Mar 2019
318
14
iran
pi(n) = number of primes less than n
i proved that:
pi(n) - pi(√n) = n × (1/2 × 2/3 × ... × p-1/p)
p = largest prime less than or equal to √n
prime number theorem: pi(n) = n/ln(n)
lim pi(√n) / pi(n) = lim √n/ln(√n) / n/ln(n) = lim 2/√n = 0
=> pi(n) - pi√n ~ pi(n) = n × (1/2 × 2/3 × ... × p-1/p)
p < √n
and
pi(n^2) = n^2 × (1/2 × 2/3 × ... × q-1/q)
q < n
=> pi(n^2)/pi(n) = n × ( p-1/p × ... × q-1/q)
p > √n , q < n
and
pi(n^2)/pi(n) = n^2/ln(n^2) / n/ln(n) = n/2
=> n/2 = n × (p-1/p × ... × q-1/q)
=> lim p-1/p × ... × q-1/q = 1/2
p>√n , q<n
for n=100 it is 0.526 ~ 1/2
for n=1000 it is 0.513 ~ 1/2
 
Aug 2012
2,495
781
pi(n) - pi(√n) = n × (1/2 × 2/3 × ... × p-1/p)
I assume the last factor is $(p-1)/p$.

I calculated $\pi(100,000) - \pi(sqrt(100,000)) = 9527$ and

$\displaystyle 100,000 \times \prod_{p < 316, \\ p \ \text{prime}} \frac{p-1}{p} = 9307.8...$

So there's some drift there. Note that sqrt(100,000) is around 316.

ps -- For n = 1,000,000 and p = 997 I got 78,330 for the left hand side of your equation and 80965.2... for the right side.

I used Wolfram Alpha to calculate the LHS and wrote a little Python program to calculate the RHS. I didn't bother to work out the primes, I just copied them into a list from here.

Can you imagine what Gauss and Euler would have done with tools like these? Probably wasted their lives looking at LOLCats and arguing with circle squarers and angle trisectors.
 
Last edited:
Aug 2012
2,495
781
Oh. Correction on the calculation of the RHS for n = 100000. I now get 9651.
 
Last edited:
Mar 2019
318
14
iran
can you calculate 100/101 × ... × 9972/9973 ?
 
Mar 2019
318
14
iran
these fractions start with 100/101 this is about the second theorem
lim (p-1)/p × ... × (q-1)/q = 1/2
√n<p , q<n
for n=10000 p=101 q=9973
100/101 × ... × 9972/9973 = 0/506 ~ 1/2
for n=100 product is 0.526
for n=1000 product is 0.513
and for n=10000 it is 0.506
 
Aug 2012
2,495
781
these fractions start with 100/101 this is about the second theorem
lim (p-1)/p × ... × (q-1)/q = 1/2
√n<p , q<n
for n=10000 p=101 q=9973
100/101 × ... × 9972/9973 = 0/506 ~ 1/2

Where does $q$ come from? This is a little confusing. Is this limit taken as both $n$ and $q$ go to infinity independently? Or does it relate to $n$ and $p$? Can you clarify please?

ps -- Oh I see, I didn't understand what you were asking earlier. My post #5 is wrong. Earlier we were calculating 1/2 x 2/3 x 4/5 x ... (p-1)/p and I thought we were still doing that. But now you are multiplying all the values of (p-1)/p for p between two arbitrary primes. Didn't realize that.

My post #2 and the correction in #3 are still correct. And actually the product of (p-1)/p between two primes r and q is just the product from 1 to q divided by the product from 1 to the prime before r. If I'm understanding your latest notation.
 
Last edited by a moderator:
Aug 2012
2,495
781
can you calculate 100/101 × ... × 9972/9973 ?
Ok I calculated this and got 0.5060344379058458.

What is the significance of 101 and 9973? What limit are you taking? Do 101 and 9973 independently go to infinity? How are they chosen?

I know that for n = 10,000, sqrt(10,000) = 100 and so p = 101 is the first prime larger than sqrt(10,000).

I know 9973 is the largest prime less than 10,000.

Ah ... is this starting to make sense? You take the smallest prime larger than sqrt(n) and the largest prime smaller than n ... ok now I get it. So the limit as n goes to infinity should be 1/2.

I wonder if someone can prove this.
 
Last edited:
Mar 2019
318
14
iran
can you calculate it for n=100000 and n=1000000