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

In summary, the formula PI(N) = N /{A * LOG(N)^2 +B * LOG(N) + C} works for N up to 10^23 with an accuracy depending on the number of digits after the decimal point in the coefficients A, B, and C. However, better approximations could be attained with increased accuracy of the coefficients. The best values for A, B, and C are (0, 2.302585, -2.302585), which was proved in the early-mid 1800s. The ratio N / PI(N) is not a straight line but curves slightly to the right, and will not straighten out above 10^23 according to Hadamard and
  • #1
jillbones
2
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
  • #2
Almost exactly n/ln(n).
 
  • #3
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.
 
  • #4
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
 
  • #5
http://primes.utm.edu/howmany.shtml#table

Consider reading section #2. There are no perfectly straight lines, as the graph shows.
 
  • #6
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.
 

What is "Prime Number Counting"?

Prime Number Counting is the process of determining the number of prime numbers that exist within a given range or a given set of numbers.

Why is "Prime Number Counting" important?

Prime numbers have a significant role in mathematics and are used in various applications such as cryptography, coding theory, and prime factorization. Prime Number Counting helps us understand the distribution and patterns of prime numbers, which can lead to important discoveries in mathematics and other fields.

How is "Prime Number Counting" done?

The most common method used for Prime Number Counting is the Sieve of Eratosthenes, which involves eliminating all the multiples of each prime number in a given range until only the prime numbers remain. Other methods include the Prime Number Theorem and Legendre's formula.

What are some challenges in "Prime Number Counting"?

One of the main challenges in Prime Number Counting is the lack of a formula or algorithm that can accurately determine the number of prime numbers in a given range. Another challenge is the increasing difficulty in finding larger prime numbers as the range increases, making it more time-consuming and resource-intensive.

What are the real-world applications of "Prime Number Counting"?

Prime Number Counting has various applications in fields such as computer science, cryptography, and number theory. It is used in creating secure encryption algorithms, generating random numbers, and identifying prime factors in large numbers.

Similar threads

Replies
5
Views
5K
  • General Math
Replies
2
Views
1K
Replies
10
Views
2K
  • Math Proof Training and Practice
2
Replies
61
Views
6K
  • Linear and Abstract Algebra
Replies
7
Views
3K
Replies
17
Views
3K
  • Math Proof Training and Practice
3
Replies
100
Views
7K
  • Math Proof Training and Practice
3
Replies
93
Views
10K
  • Math Proof Training and Practice
2
Replies
52
Views
9K
Back
Top