Re: Mystery rejection, 3-d prime counting function

From: Christian Bau (christian.bau_at_cbau.freeserve.co.uk)
Date: 06/26/04


Date: Sat, 26 Jun 2004 19:19:58 +0100

In article <f9a5a56b.0406261002.6a797c97@posting.google.com>,
 mattgrime@o2.co.uk (matt grime) wrote:

> I just googled for prime counting function, and no mention of you came
> up. In fact apart from *the* prime counting function the following
> hits came up on the first page:
>
> Legendre's formula, Lehmer's formula, Mapes' method, Meissel's
> formula....
>
> legendre's formula, and setting one variable to sqrt(x), looks exactly
> the same as yours, and is noted to be a very inefficient way of
> counting primes.

I wouldn't exactly put it like that. The straightforward method (apart
from checking each number in turn for primality and counting the ones
which are primes, which would be downright stupid) would be to create a
huge sieve of the primes and count them. Legendre's formula effectively
calculates how many composite numbers you remove from the sieve while
avoiding the work of creating the sieve and actually removing the
composite numbers, so it is a significant step forward. Faster than
doing a sieve by a huge constant factor.

So it is not really inefficient, it is just very inefficient compared to
other methods that had 200 years to improve on it. The improved methods
still use exactly the same formula, they just use sieves in increasingly
clever ways to find many of the intermediate results that are needed.
And one of the first attempts of Harris tested whether n was prime by
comparing pi (n) and pi (n-1). If you do that often enough, then you get
something that is _really_ inefficient.

> I don't think anyone doubts you have something that counts primes,
> just something not very efficient or original. Are you about to cry
> wolf again?



Relevant Pages

  • Re: Mystery rejection, 3-d prime counting function
    ... > counting primes. ... huge sieve of the primes and count them. ... composite numbers, so it is a significant step forward. ... So it is not really inefficient, it is just very inefficient compared to ...
    (sci.math)
  • Re: Epistemology 201: The Science of Science
    ... > I looked at the sieve of eratosthenes. ... What does filtering out composite ... Let g map the integers Z =into the primes. ... generate the infinite sequence of primes so g= 2, ...
    (sci.math)
  • Re: Epistemology 201: The Science of Science
    ... > I looked at the sieve of eratosthenes. ... What does filtering out composite ... Let g map the integers Z =into the primes. ... generate the infinite sequence of primes so g= 2, ...
    (sci.cognitive)
  • Re: Epistemology 201: The Science of Science
    ... > I looked at the sieve of eratosthenes. ... What does filtering out composite ... Let g map the integers Z =into the primes. ... generate the infinite sequence of primes so g= 2, ...
    (sci.physics)
  • Re: How to Generator Prime Numbers in a short time ?
    ... upper limit for the primes I use in the sieve step and that 4096 is the size ... of the vector to sieve. ... tests and the sieving comes in. ... inefficient ). ...
    (sci.crypt)