Estimation of sum of prime numbers less than "n"

We know that the number of prime numbers less than xx tends to xln(x)\frac { x }{ \ln { \left( x \right) } }

Using this I have thought of a way of estimation of sum of prime numbers less than "n".

Using the formula above, we get that the number of prime numbers less than xx is xln(x)\frac { x }{ \ln { \left( x \right) } } , so the number of prime numbers less than x+1x+1 is x+1ln(x+1)\frac { x+1 }{ \ln { \left( x+1 \right) } }.

So we can say that the probability of x+1x+1 being prime is x+1ln(x+1)xln(x)1\frac { \frac { x+1 }{ \ln { \left( x+1 \right) } } -\frac { x }{ \ln { \left( x \right) } } }{ 1 }

As xx will grow bigger, 11 will become a very small value for it, so we can replace it with dxdx. Here dxdx is the small quantity we generally use in calculus.

Probability of x+dxx+dx being prime is x+dxln(x+dx)xln(x)dx\frac { \frac { x+dx }{ \ln { \left( x+dx \right) } } -\frac { x }{ \ln { \left( x \right) } } }{ dx }

Solving the derivative, we get that the probability of xx being prime is:- 1ln(x)1(ln(x))2\frac { 1 }{ \ln { \left( x \right) } } -\frac { 1 }{ { \left( \ln { \left( x \right) } \right) }^{ 2 } }

We can generally say that the sum of prime numbers less than nn is i=2niP(i)\sum _{ i=2 }^{ n }{ iP\left( i \right) } . Here iP(i) iP\left( i \right) is the probability of ii being prime.

So we can rewrite this summation as an integration:- 2nx(1ln(x)1(ln(x))2)dx\int _{ 2 }^{ n }{ x\left( \frac { 1 }{ \ln { \left( x \right) } } -\frac { 1 }{ { \left( \ln { \left( x \right) } \right) }^{ 2 } } \right) } dx

Solving the integration, we get (Here β(n)\beta \left( n \right) represents sum of prime numbers less than "n"):- β(n)=n2ln(n)li(n2)[4ln(2)li(4)]\beta \left( n \right) =\frac { { n }^{ 2 } }{ \ln { \left( n \right) } } -li({ n }^{ 2 })-\left[ \frac { 4 }{ \ln { \left( 2 \right) } } -li\left( 4 \right) \right]

Ignoring the constant value on the RHS, which would be too small as nn grows bigger, we have:- β(n)=n2ln(n)li(n2)\boxed { \beta \left( n \right) =\frac { { n }^{ 2 } }{ \ln { \left( n \right) } } -li({ n }^{ 2 }) }


Please read this and comment if there are any mistakes or about anything else regarding this derivation. If you are good at coding, please check if this formula works for large numbers.

Thanks.

#NumberTheory

Note by Archit Boobna
5 years, 7 months ago

No vote yet
1 vote

  Easy Math Editor

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

  • Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
  • Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
  • Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.
  • Stay on topic — we're all here to learn more about math and science, not to hear about your favorite get-rich-quick scheme or current world events.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold

- bulleted
- list

  • bulleted
  • list

1. numbered
2. list

  1. numbered
  2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1

paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
    # 4 spaces, and now they show
    # up as a code block.

    print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in \( ... \) or \[ ... \] to ensure proper formatting.
2 \times 3 2×3 2 \times 3
2^{34} 234 2^{34}
a_{i-1} ai1 a_{i-1}
\frac{2}{3} 23 \frac{2}{3}
\sqrt{2} 2 \sqrt{2}
\sum_{i=1}^3 i=13 \sum_{i=1}^3
\sin \theta sinθ \sin \theta
\boxed{123} 123 \boxed{123}

Comments

Your formula seems to approximate quite well even for huge values of n, see for yourself.

We can however simplify it by approximating pi(n) using the Prime Number Theorem :

π(n)nln(n)\pi(n) \simeq \frac{n}{ln(n)}

instead of li(n)li(n)

so that we have : β(n)n2ln(n)n2ln(n2)\beta(n) \simeq \frac{n^2}{ln(n)} - \frac{n^2}{ln(n^2)} β(n)n2ln(n2)n22ln(n)\beta(n) \simeq \frac{n^2}{ln(n^2)}-\frac{n^2}{2 \cdot ln(n)} Finally, β(n)n22ln(n)π(n2)\beta(n) \simeq \frac{n^2}{2 \cdot ln(n)} \simeq \pi(n^2)

This gives better results, while being simpler. The accuracy for relatively big values of n (n > 10^3) can be enhanced by replacing back pi(n) with li(n) :

β(n)li(n2)\boxed{\beta(n) \simeq li(n^2)}

Below is the graph of the difference between your formulae and the actual values, up to n = 10^5.

Plot[ Sum[
   n<em>Boole[PrimeQ[n]], {n, 2, i}] - ((i^2)/Log[i] - 
    LogIntegral[i^2]), {i, 2, 10^5}] Plot[ Sum[ nBoole[PrimeQ[n]], {n, 2, i}] - ((i^2)/Log[i] - LogIntegral[i^2]), {i, 2, 10^5}]

And here is the graph of the difference between li(n^2) and the actual values, up to n = 10^5.

Plot[LogIntegral[i^2] - Sum[n<em>Boole[PrimeQ[n]], {n, 2, i}], {i, 2, 
  10^5}] Plot[LogIntegral[i^2] - Sum[nBoole[PrimeQ[n]], {n, 2, i}], {i, 2, 10^5}]

As we can see, your formulae tends to "go away" from the actual values but in a rather nice/smooth way while li(n^2) is generally closer to the actual values but the variations of the difference are looking more random.

This last approximation gets very close to the actual value as n gets big :

li((1012)2)β(1012)=li(1024)β(1012)=1.0000006083242533806771...\frac{li((10^{12})^2)}{\beta(10^{12})} = \frac{li(10^{24})}{\beta(10^{12})} = 1.0000006083242533806771...

(1012)22ln((1012)2)β(1012)=π(1024)β(1012)=0.9815582161130313615399...\frac{\frac{(10^{12})^2}{2 \cdot ln((10^{12})^2)}}{\beta(10^{12})} = \frac{\pi(10^{24})}{\beta(10^{12})} = 0.9815582161130313615399...

1024ln(1012)li(1024)β(1012)=0.9631158239018093424027...\frac{\frac{10^{24}}{ln(10^{12})} - li(10^{24})}{\beta(10^{12})} = 0.9631158239018093424027...

nathan soufflet - 5 years, 7 months ago

Log in to reply

Thanks a lot for the improvements!! :) Found it really helpful.

Archit Boobna - 5 years, 7 months ago

Log in to reply

You're welcome :)

I thought of a simpler way of getting the same result, although your reasoning is nice :

Directly from the Prime Number Theorem, we get :

π(n)nln(n)\pi(n) \simeq \frac{n}{ln(n)}

So, we have : P(n)π(n)n nln(n)nP(n) \simeq \frac{\pi(n)}{n}\ \simeq \frac{n}{\frac{ln(n)}{n}}

P(n)1ln(n)P(n) \simeq \frac{1}{ln(n)}

hence :

β(n)=i=2niP(i)nln(n)dn\beta(n) = \sum_{i=2}^{n}{i\cdot P(i)} \simeq \int{\frac{n}{ln(n)}}dn

and nln(n)dnEi(ln(n2))Ei(2ln(n))\int{\frac{n}{ln(n)}}dn \simeq Ei(ln(n^2)) \simeq Ei(2 \cdot ln(n))

where Ei(n) is the exponential integral, however we know that : li(n)=Ei(ln(n))li(n) = Ei(ln(n))

So, we have : Ei(2ln(n))=li(n2)Ei(2 \cdot ln(n)) = li(n^2)

We end up with our nice formula : β(n)li(n2)\boxed{\beta(n) \simeq li(n^2)}

More generally, β(n,p)=i=2nipP(i)li(np+1),(n,p)(R+)2,n1\beta(n, p) = \sum_{i=2}^{n}{i^{ p} \cdot P(i)} \simeq li(n^{p+1}), \forall (n, p) \in (\mathbb{R^+})^2, n \neq 1

nathan soufflet - 5 years, 7 months ago

Your really smart.. which institutes your appearing for

random rocket99 - 3 years, 1 month ago

I have tested this too, when I tried it for n=100, it gave 925 which is quite close to 1060, the actual answer.

Archit Boobna - 5 years, 7 months ago
×

Problem Loading...

Note Loading...

Set Loading...