Tugger the SLUGger!SLUG Mailing List Archives

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


hi all
i took the commen advice and i am teaching myself c++ ;-)

i have played with a few things and am going well but im stumped with a
problem..

i decided to make a prime number generator. I started with
plain brute force trying every combo and it all worked well.

i was wondering if someone could give me a hand on how to test the last
number ie.

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

hope it is understanderble i just have a shocking migraine

thanks 
alex