Thread: Prime numbers
View Single Post
Old May 17th, 2005, 7:51 AM   #8
thomzor
Newbie
 
Join Date: Apr 2005
Location: The Netherlands
Posts: 20
Rep Power: 0 thomzor is on a distinguished road
Thirdly, (and this one's common sense), you only need to test half the numbers up to the value of the tested number. I.e, you know that x will not be cleanly divisible by a number that's greater than x/2, apart from x.

did that in my previous program, that must be why this one is 4 seconds slower on the 100000 -.- :p
this one takes about 7 seconds, my previous one did it in 3,5 but deleted it
thanks for pointing that out

im also working on the one w/ only odd numbers
cya
thomzor is offline   Reply With Quote