Prime number module

Lulu of the Lotus-Eaters mertz at gnosis.cx
Tue Sep 30 13:13:57 EDT 2003


|> > So I only expect around 5,428,681 primes less than 10^8 to occur.
|> > Well, that's not SO much less than 7.8M.

|Klaus Alexander Seistrup
|> I found 5,761,455 primes < 1E8.

"Andrew Dalke" <adalke at mindspring.com> wrote previously:
|http://www.utm.edu/research/primes/howmany.shtml has the same number.
|(found by googling for "5,761,455" - 3rd hit. :)

Looking at Andrew's resource, I am reminded that N/(log(N)-1) is a
better approximation for "primes up to N" than was Gauss' original.  Of
course, as I wrote, both are accurate at the asymptote.  But infinity is
a long way to go.

    >>> N = 10**8
    >>> N/(log(N)-1)
    5740303.8072846411

That looks assuringly closer to the specific total than my first pass.
Obviously, enumeration of all the primes in the range is still more
accurate than any such approximation formula (some further such
approximations can be found at the above URL, and elsewhere).

Yours, Lulu...

--
 mertz@  _/_/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY: \_\_\_\_    n o
gnosis  _/_/             Postmodern Enterprises            \_\_
.cx    _/_/                                                 \_\_  d o
      _/_/_/ IN A WORLD W/O WALLS, THERE WOULD BE NO GATES \_\_\_ z e






More information about the Python-list mailing list