Prime-counting function questions

  • Context: Undergrad 
  • Thread starter Thread starter AdamsJoK
  • Start date Start date
  • Tags Tags
    Function
Click For Summary

Discussion Overview

The discussion revolves around the prime counting function, denoted as pi(x), focusing on its existence, the lack of a clear formula, and the use of approximations and algorithms for its computation. Participants explore the theoretical and practical aspects of defining and calculating this function.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • Some participants express confusion about the existence of the prime counting function and the absence of a straightforward formula for pi(x).
  • One participant clarifies that a function does not need a formula; it only requires a procedure to determine outputs for given inputs.
  • Another participant mentions that while there are formulas for pi(x), they can be computationally intensive and inefficient, especially for large values of x.
  • There is a suggestion that the choice of algorithm significantly impacts the efficiency of computing the prime counting function.
  • Some participants note that approximations are acceptable as they yield values close to integers, which can be rounded for accuracy.
  • One participant acknowledges the difficulty of computing pi(x) due to the rapid growth of factorials in certain formulas.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the existence of a clear formula for the prime counting function, with some asserting that approximations are necessary while others highlight the existence of complex formulas. The discussion remains unresolved regarding the best approach to compute pi(x).

Contextual Notes

Limitations include the computational inefficiency of certain formulas for large x and the dependence on the choice of algorithms for practical computation.

AdamsJoK
Messages
4
Reaction score
0
I'm confused about the existence of the prime counting function.

When I search for information about pi(x), I turn up a lot of information on approximations and algorithms for finding pi(x) but there doesn't seem to be any clear cut formula, yet it seems to exist?
If there exists formula for the prime counting function, is it that they just aren't very friendly to work with and therefore we resort back to using the approximations? If so, what makes them hard to work with exactly?

Thank you.
 
Mathematics news on Phys.org
AdamsJoK said:
I'm confused about the existence of the prime counting function.

When I search for information about pi(x), I turn up a lot of information on approximations and algorithms for finding pi(x) but there doesn't seem to be any clear cut formula, yet it seems to exist?

The mathematical definition of a "function" doesn't require that function have a formula. It only requires that each x in the domain of the function is mapped to some unique y in the co-domain. To show a function exists, you only have to show that some procedure exists for finding y once x is given. The procedure for the prime counting function is "List all the prime numbers that are less than equal to x and count how many numbers are in the list".

People interested in mathematics are interested in functions that do have formulas of the usual type. It would be nice to discover such a formula for the prime counting function, but (as far as I know) all that is currently available are approximations.

People who study computer science, study algorithms and often these are functions that can't be implemented as straightforward formulas. For example, a computer could be programmed to compute the prime counting function. The program wouldn't be a simple one-line formula. There would be a lot of steps to the program.
 
  • Like
Likes   Reactions: Lucas SV and AdamsJoK
Figures I was being sloppy, a function is just a ordered pair(with some rules). The 2nd paragraph answers the question.

Helpful post, I appreciate it, thank you.
 
I don't know what you call clear cut, but i found two formulas that look prety clear to me:
NumberedEquation7.gif

from http://mathworld.wolfram.com/PrimeCountingFunction.html, and
NumberedEquation1.gif

from http://mathworld.wolfram.com/RiemannPrimeCountingFunction.html. ##f## and ##\mu## are defined in the webpage.

The second formula is more algorithmic, if you look at the definitions. But the first formula is also computationally intensive. The choice of algorithm certainly matters for the computer scientist, and algorithms that lead to approximate solutions are fine too because the computed values should be close to an integer, so they can be rounded to get the correct value, which we know is an integer.

But perhaps the better reason to use approximations, is that for large ##n##, the exact algorithms are extremely inefficient, in particular the first formula (Hardy and Wright, 1979). Just you try computing ##\pi(100)## and you will see what I mean.

What you really want is a easy formula to compute the prime counting function, but what you really should ask for is the best algorithm for computing it. To make this point clear we consider the function ##f(x)=x^2+3x##. The formula I have given actually prescribes a great algorithm to compute the values of the function. It just happens that in this case, the computational power you need is very small, compared to ##\pi(x)##. I'm just highlighting the obvious but overlooked fact that how hard it is to compute values for functions depends on the algorithm you use, and on the functions themselves.
 
Last edited:
  • Like
Likes   Reactions: AdamsJoK
Hey Lucas SV, you're right I do mean easy to compute. I overlooked the first which is pretty "clear cut" but as you have said, it's useless because of how large factorials get.

Appreciate the insight, thank you.
 
Lucas SV said:
approximate solutions are fine too because the computed values should be close to an integer, so they can be rounded to get the correct value, which we know is an integer
Try using an approximate solution to compute pi(x) - pi(x-1).
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
7
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 16 ·
Replies
16
Views
3K