[Gllug] What to do in 151 days?

Nix nix at esperi.demon.co.uk
Thu Sep 27 23:08:52 UTC 2001


On Wed, 26 Sep 2001, Harry Jackson said:
> I wrote a small c program a while back (as a way of learning that damned
> language) to find primes (and to benchmark my PC) but I am unsure as how to
> go about factoring them once found ;-)

This was one of my first C projects, too. For a quick hack (where you
don't care about speed or memory consumption much) the Sieve of
Eratosthenes is good enough (look it up, it's really simple but it's too
late at night for me to blither about it now, I'd doubtless fsck it up;
I've been awake for ~2 days), but for real stuff you *do* care about
time and space complexities, so you have to use better algorithms.

One common technique is to do the initial sieving using an algorithm
that finds numbers that are probably prime, then fully factor those
numbers; you won't catch all primes that way, but you'll catch some.

(Kieran, this is way outside my field; feel free to take over :) )

-- 
`Upsetting this BOFH was a BAD MOVE.' --- Chris Newport

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list