Calculating Prime Number Counts Using PI(N) Formula up to 10^23

  • Context: Graduate 
  • Thread starter Thread starter jillbones
  • Start date Start date
  • Tags Tags
    Counting Prime
Click For Summary

Discussion Overview

The discussion revolves around the calculation of prime number counts using the PI(N) formula, specifically for values of N up to 10^23. Participants explore the accuracy of coefficients in the formula and the implications of their values on the results.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant presents the formula PI(N) = N /{A * LOG(N)^2 + B * LOG(N) + C} and shares specific calculated values for A, B, and C, noting that the accuracy of the formula is contingent on these coefficients.
  • Another participant suggests that the approximation (A, B, C) = (0, 1/log e, 0) is reasonable, and mentions that the best values are (0, 1/log e, -1/log e), referencing historical proofs from the early-mid 1800s.
  • Concerns are raised about the accuracy of the formula, with one participant indicating that the ratio N / PI(N) does not behave as a straight line up to N = 10^23, suggesting it curves imperceptibly to the right.
  • There is a discussion about the nature of historical proofs regarding prime number distribution, with one participant questioning whether the early-mid 1800s proof was purely theoretical or based on empirical data.
  • Another participant asserts that if the function were a straight line, coefficients A and B would be zero, and challenges the accuracy of alternative coefficient choices beyond certain values of N.
  • One participant references a source that indicates there are no perfectly straight lines in the context of prime number distribution.

Areas of Agreement / Disagreement

Participants express differing views on the accuracy and behavior of the PI(N) formula and its coefficients. There is no consensus on the best approach or the implications of the historical proofs discussed.

Contextual Notes

Participants note limitations in the precision of calculations due to the number of digits used in the coefficients and the inherent challenges in predicting prime counts accurately.

jillbones
Messages
2
Reaction score
0
PI(N) = N /{A * LOG(N)^2 +B * LOG(N) + C}. Note: LOG(N) is the common log.

This formula works for N up to 10^23. The accuracy depends on the number of digits
after the decimal point in the coefficients A, B & C. I used a Lotus123 spreadsheet to
calculate them. My calculated values are;

A = -0.000223480708389211732
B = 2.31221822291801513
C = -1.12554500288863357

The correct value of PI(10^23) = 1,925,320,391,606,803,968,923. The calculated value is
1,925,400,258,044,147,870,000


Not exact, but within .005%

I think that better approximations could be attained if the accuracy of the coefficients was
increased. But I have no way of testing this hypothesis

Bill J
 
Physics news on Phys.org
Almost exactly n/ln(n).
 
jillbones said:
PI(N) = N /{A * LOG(N)^2 +B * LOG(N) + C}. Note: LOG(N) is the common log.

This formula works for N up to 10^23. The accuracy depends on the number of digits
after the decimal point in the coefficients A, B & C. I used a Lotus123 spreadsheet to
calculate them. My calculated values are;

A = -0.000223480708389211732
B = 2.31221822291801513
C = -1.12554500288863357

Borek suggests that (A, B, C) = (0, 1/log e, 0) is a reasonable approximation, which is true. The best values are actually (0, 1/log e, -1/log e) which was proved (as I recall) in the early-mid 1800s. For base-10 logs, that's (0, 2.302585, -2.302585), so your numbers are fairly close.
 
CRGreathouse said:
Borek suggests that (A, B, C) = (0, 1/log e, 0) is a reasonable approximation, which is true. The best values are actually (0, 1/log e, -1/log e) which was proved (as I recall) in the early-mid 1800s. For base-10 logs, that's (0, 2.302585, -2.302585), so your numbers are fairly close.
I used the values of PI(N) from the table in the Wikipedia article "Prime Number Theorem" to calculate A, B & C.

I did a simple data regression analysis of N / PI(N) vs LOG(N) & LOG(N)^2. If the function was truly a straight line; A would be 0.000000000000 ... !

My results suggest that up to N = 10^23, the ratio N / PI(N) is not exactly a straight
line; but curves imperceptibly to the right. It may straighten out above 10^23, who
knows?

N / PI(N) is the ideal function; N, PI(N), LOG(N) and LOG(N)^2 can all be exact integers.
The problem is that N / PI(N), A, B & C cannot be precisely calculated with only 18 digit accuracy.

Was the early-mid 1800's proof purely theoretical or was it based on empirical data?

When you calculated PI(N) using the formula I suggested, what sort of errors did
you get?

p
 
http://primes.utm.edu/howmany.shtml#table

Consider reading section #2. There are no perfectly straight lines, as the graph shows.
 
jillbones said:
I did a simple data regression analysis of N / PI(N) vs LOG(N) & LOG(N)^2. If the function was truly a straight line; A would be 0.000000000000 ... !

If the function was a line, A and B would be 0. You're free to pick any values you choose, but if you choose anything other than the ones I gave, beyond some (large) N, my function will always be more accurate than yours. But that shouldn't be particularly surprising in your case: it's clear that beyond N = 10^4494 or so, your formula predicts a negative number of primes...

jillbones said:
My results suggest that up to N = 10^23, the ratio N / PI(N) is not exactly a straight
line; but curves imperceptibly to the right.

Correct.

jillbones said:
It may straighten out above 10^23, who
knows?

Hadamard (1896) and de la Vallée-Poussin (1896) proved that it does not.

jillbones said:
Was the early-mid 1800's proof purely theoretical or was it based on empirical data?

It was a proof (hence theoretical), not a conjecture. The original conjecture (late 1700s, I think) was based on empirical evidence, though.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 61 ·
3
Replies
61
Views
10K
  • · Replies 17 ·
Replies
17
Views
5K
  • · Replies 5 ·
Replies
5
Views
9K
  • · Replies 100 ·
4
Replies
100
Views
12K