home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.hackers
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!menudo.uh.edu!nuchat!taronga!peter
- From: peter@taronga.com (Peter da Silva)
- Subject: Re: Prime Number Generator
- Message-ID: <46UIP4L@taronga.com>
- Organization: Taronga Park BBS
- References: <grtyj5-@rpi.edu>
- Date: Mon, 31 Aug 1992 11:03:15 GMT
- Approved: you could have looked all this up in your local library
- Lines: 30
-
- In article <grtyj5-@rpi.edu> cleggp@aix.rpi.edu (Paul Jason Clegg) writes:
- >I'm interested in generating large prime numbers for use in some public key
- >code encryption schemes, and I'm looking for the fastest way to generate all
- >the primes from 2 up to as high as I can go on my 386/25 (Using BC++ 3.1, I
- >figured this is somewhere in the what, 4 billion range?)
-
- 1. These are unlikely to be large enough.
- 2. Try the Seive of Eratosthenes. That's the greek dude you're thinking of.
- You only need to test the *primes* up to the square root of the number
- in question, and since you're generating all the primes you already
- *know* them all. Just use the standard seive up to 64K (no sweat) and
- use the primes in this array to test the rest of the number space.
-
- There is code for the seive all over the place, since Byte used it as a
- numerical benchmark for many years.
-
- >But. Does anyone know of even more efficient algorithm for determining the
- >primeness of numbers?
-
- See above.
-
- >Has anyone ever come up with a O(n) algorithm for it?
-
- If anyone does, there won't be any point in using primes for cryptosystems
- any more.
- --
- `-_-'
- Have you hugged your wolf today? 'U`
-
- Peter da Silva, Taronga Park BBS, Houston, TX +1 713 568 0480/1032
-