Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] c++... a bit OT


On Wed, Nov 15, 2000 at 01:28:48PM +1100, alex060@xxxxxxxxxxxxxxxx wrote:
> all primes end in either 1 3 7 or 9 except  2 and 5
>  so it is pointless to test it if it dosent ie ends in a 5, so how can i
> test to see if the last number is 1 3 7 9  before i start the curnum % x
> !=0

9 = 3*3.  It isn't prime
</pedant>  

You could first try mod-ing it against some of the more common ones, like 2,
3, 5, before going into your loop.  That'll knock out everything ending in
2, 4, 6, 8 and 9.  Forgive me if this sounds blatantly wrong, I'm not too
familiar with the technique you're using.

This is a linux list.  You'd be alot better off looking at c++ groups on
Usenet, or you should find a couple of relevant mailing lists on
http://www.liszt.com/
</not-quite-flame>

While we're at it, can anybody suggest a good C mailing list?  They seem to
be fairly thin on the ground.

Cheers,
Peter
</psuedo-html>