Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Feb 1998 09:33:56 +0100
From:      Eivind Eklund <eivind@yes.no>
To:        Anatoly Vorobey <mellon@pobox.com>, hackers@FreeBSD.ORG
Subject:   Re: RE: New utilities: factor(1) and wid(1)?
Message-ID:  <19980226093356.27757@follo.net>
In-Reply-To: <19980226002846.05689@techunix.technion.ac.il>; from Anatoly Vorobey on Thu, Feb 26, 1998 at 12:28:46AM %2B0200
References:  <01BD420C.2FCDD020.meuston@jmrodgers.com> <19980226002846.05689@techunix.technion.ac.il>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 26, 1998 at 12:28:46AM +0200, Anatoly Vorobey wrote:
> It won't, at least not easily. It keeps a fixed precomputed table
> of all primes up to 2^16 to do a simple sieve (in 
> /usr/src/games/primes/pr_tbl.c, also used by primes(1)); would be, 
> err, an interesting exercize to change that to a fixed precomputed 
> table of all primes up to 2^32 and watch the executable size go up,
> up, up into tens of megabytes and beyond...
> 
> It's time for to rewrite them both to use a more modern method 
> of factoring, I guess. It's been some 2500 years or so; ole' good 
> Eratosthenes could use some rest :)

If somebody need a pure prime-generator, I've got one lying around
somewhere.  A full sieve, no pre-computed tables.  Not top-notch for
really large sieving, but OK for <32 bits at least (and could AFAIR
scale beyond that; I think I did it as a 2-layer sieve to be able to
scale to infinity.  Still won't be the fastest method for factoring,
though.)

License negotiatable (BSD, public domain, GPL - anything you want, as
long as it doesn't involve me paying anybody else money at a later
date ;-)

Eivind.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980226093356.27757>