home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: sci.math
- Path: sparky!uunet!gatech!mailer.cc.fsu.edu!fsu1.cc.fsu.edu!rose
- From: rose@fsu1.cc.fsu.edu (Kermit Rose)
- Subject: Re: Primes
- Message-ID: <1992Aug22.040442.17832@mailer.cc.fsu.edu>
- News-Software: VAX/VMS VNEWS 1.3-4
- Sender: news@mailer.cc.fsu.edu (Usenet News File Owner)
- Nntp-Posting-Host: fsu1.cc.fsu.edu
- Reply-To: rose@fsu1.cc.fsu.edu
- Organization: Florida State University
- References: <9208171021.aa01492@Paris.ics.uci.edu> <1992Aug18.091619.10152@waikato.ac.nz>
- Distribution: world
- Date: 21 AUG 92 23:59:30
- Lines: 44
-
- In article <1992Aug18.091619.10152@waikato.ac.nz>, bill@waikato.ac.nz writes...
- >In article <9208171021.aa01492@Paris.ics.uci.edu>, kibler@turing.ICS.UCI.EDU (Dennis Kibler) writes:
- >> In mathematica the number of primes less than n or equal to n
- >> is given by PrimePi[n].
- >>
- >> The following took about 1 second to compute.
- >>
- >>
- >>
- >> Do[Print[i," ",PrimePi[2^i]],{i,30}]
- >> 1 1
- >> 2 2
- >> 3 4
- >> 4 6
- >> 5 11
- >> ....
- >> 28 14630843
- >> 29 28192750
- >> 30 54400028
- >>
- >
- >Does anyone know how Mathematica stores its table of primes, and how efficient
- >it is in terms of space and access time? What's the minimum space a table
- >of primes can be compressed into if constant access time to find the nth prime
- >is required?
- >
- >Bill Teahan,
- >Systems Programmer,
- >University of Waikato,
- >Hamilton, New Zealand.
- >"I have never been lost, but I will admit to being confused for several weeks."
- >-- Daniel Boone.
-
- In general, one can use a bitmap to represent a prime number table. Some
- compression can be obtained by representing only odd numbers, or only
- odd numbers not divisible by 3.
- Then the computer can count primes by using the count bits function of the
- hardware amazingly fast. If the computer does not have a count bits
- function, then this technique is lost.
-
- rose@fsu1.cc.fsu.edu To be sure I see your response, use e-mail.
- -----------------------------------------------------------------------
- You may post, repost, or publish ANY communication received from me.
- Be of good cheer, for it is much more fun than being depressed.
-