#### Topic: Prime counting function

Hi Ivan,

Graph has some great functions, such as gamma and zeta, but none that directly relate to primes, such as:

pi(n): You would need another name for the function since pi is used as a constant in Graph.

isprime(n): For small n there are some good ideas on efficiently storing a lookup table of small primes at http://www.rsok.com/~jrm/printprimes.html and for large n there are primality tests much faster than trial division by all primes to sqrt(n).

iscomposite(n) or notprime(n): This one could be implemented using the Miller–Rabin test.

Graphing the behavior of primes is highly desirable for any graphing program. I might be able to implement a simple sieve just using Graph's existing functions. Though I suspect your recommendation will be to use a Python script, having some functions for working with primes built in to Graph would be more convenient. Remember, accuracy is only required to the limit of Graph's x-axis, not infinity.

Some other functions to consider implementing that would be useful to number theory graphs:

Riemann's prime-counting function

Logarithmic integral function

Exponential integral function

von Mangoldt function

Möbius function

Euler's totient (phi) function

sfn(n) is n a square free number?

Lucas-Lehmer test