Files changed (3)
- Ignore whitespace
+In the two previous exercises we have seen three different methods for computing the prime-counting function n(n), all based on a formula of Legendre. We have also seen the difficulty of the calculation, as three eminent mathematicians got their sums wrong, and the difficulty continues even today with the use of computers, as Xavier Gourdon had to stop an attempt to compute n(10**23) because of an error. Given the difficulty of calculation, in some cases it might make sense to calculate an approximate value of n, instead of an exact value. In today's exercise we look at two methods for approximating the prime-counting function.
+The first method dates to the German mathematician Carl Friedrich Gauss, who gives an estimate n(x) ~ Li(x), the logarithmic integral--this is the celebrated prime number theorem, which Gauss figured out when he was fifteen years old! The logarithmic integral can be calculated by expanding the infinite series
+to the desired degree of accuracy; somewhere around a hundred terms ought to be sufficient for arguments up to 1012. Beware the singularity at x=0.
+In 1859, Bernhard Riemann, whose hypothesis about the prime numbers is one of the greatest open questions in mathematics, described a different, and much more accurate, approximation to the prime counting function:
+where mu(n) is the Möbius function that takes the value 1 when n is 1, 0 when the factorization of n contains a duplicated factor, and (-1)k, where k is the number of factors in the factorization of n, otherwise. There is no better way to compute the Möbius function than to compute the factors of n. As with the logarithmic integral, about a hundred terms of the infinite series ought to be sufficient to get a good approximation for arguments up to 1012.
+Your task is to write functions to compute the logarithmic integral, the Möbius function, and Riemann's R function, and to compare the results to the values you calculated for the prime-counting function in the previous exercise. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
- Ignore whitespace