Tugger the SLUGger!SLUG Mailing List Archives

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


hi 
what do u mean by that exactly 3 to sqrt(x) by 2... what is x 

i basicly get say the number what ever it is.. i originaly did say the num
was 10 i did 10 % 9 then 10%8 then 10%7 etc if the answer to all of them
(except 1 of course) is 0 then i add it to the list

i then as u say div 2 before hand to see.

my idea was that as all primes end in 1,3,7,9 (not all ending 1 3 7 9 are
primes tho) so i wouldent need to start testing the number if it ended in
say 5. sure this would slow down the working initily but as i get in to
the say the 50000 or more it would dramticly reduce time in the long
run.. i hope ;-)

James said somthing about doing everything in binary. what would be the
actually outcome of this i mean how could i extract the last digit and set
it to a int to test it as such??

thanks
alex

On Tue, 14 Nov 2000, Jon Carnes wrote:

> Dude, your thinking in terms of decimal...
> 
> Test for div by 2, then use the sqrt to limit your testing: 3 to sqrt(x) by
> 2
> 
>