PrimeNumbers.hpp File Reference

Plans regarding prime numbers. More...

Go to the source code of this file.

Detailed Description

Plans regarding prime numbers.

Enumerating prime numbers
  • There is an enormous literature with estimations of count_primes.
  • We should implement such estimations.
  • DONE Most basic is approx_count_primes_0 and approx_count_primes_1.
  • Approximation via the logarithmic integral:
    1. DONE Perhaps we should integrate starting from 0, not from 2?
    2. DONE This yields +1.045, for the prime number 2.
    3. DONE (works with the build-in function) However then the numerical evaluation does not work.
    4. DONE The integral from 0 to x is given by expintegral_li(x).
    5. DONE (likely corrected by Maxima community) The documentation for expintegral_li(x) says "expintegral_li (<n>,<z>)", however two arguments are not accepted? Ask the Maxima mailing list.
    6. So currently the higher logarithmic integrals Lih(x,m) can not be evaluated using Maxima (and thus we integrate starting with 2).
    7. It is actually questionable whether to start with 0 or 2: Apparently some call it "European" to start with "2", and "American" to start with 0.
    8. And it's not so clear whether actually the indefinite integrals over the interval [0,2] exist for m>=2.
    9. Hans Werner Borchers <hwborchers@googlemail.com> writes:
      I had some time today to search, and after using Wolfram's Online
      Integrator and the NIST Digital Library of Mathematical Functions, I
      came up with the following solution,
          \int 1/log(x)^m = - Em(-log(x))/log(x)^{m-1} ,
      where Em is a generalized exponential integral, that is available in
      the 'gsl' package as
          expint_En(m, x)
      And as 'En(.,x)' is available in R, so all the higher logarithmic
      integrals can be computed as well.  Of course, you have to be careful
      to avoid all their singularities.
      (see Buildsystem/ExternalSources/SpecialBuilds/plans/R.hpp).
    10. So the Maxima functions would be
      Lih_n(x,m) := -expintegral_e(m,-log(x))/log(x)^(m-1) - (-expintegral_e(m,-log(2))/log(2)^(m-1));
      also integrating from 2.
    11. This looks like a better computation.
    12. Hans Werner Borchers also mentions formulas like
          \int 1/\log(t)^2 dt = -t/\log(t) + li(t)
          \int 1/\log(t)^3 dt = 1/2 * ( -t/\log(t)^2 - t/\log(t) + li(t) )
      which we need to check.
  • What is known about this function?

Definition in file PrimeNumbers.hpp.