This one time, at band camp, [EMAIL PROTECTED] said:

>all primes end in either 1 3 7 or 9 except  2 and 5

How about 39?  That's not prime :)  You need a better heuristic ;)

> 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

Well, you could convert it to a string, and look at the last character.
I think you're going to spend more time in the conversion than you think
you'd save by using it.

Another way, is to do your computations in binary, then you can mask off
the last couple of bits.  i.e.: 1, 2, 3, 5, 7, 9, B, C, F are prime, you
can get the last 8 bits of an int by doing something like last8 = num &
0xF

-- 
     Sure, I subscribe to USENET, but I only get it for the articles.
(o_ '
//\
v_/_


-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to