michaeled314,
ASM has divisions so why not use them?
On the other hand, divisions can be slow so not using them may save time.
One way to do it would be to set up a 1000 byte array with each location representing a number from 1 to 1000.
Count through the array in steps of 3 and set each third byte
Count through the array in steps of 5 and set each fifth byte.
Scan through the array and see which bytes are set, if set add the array index to the sum so far.
Another way, without needing an array, would be to sum the numbers 3,6,9,etc upto 1000. Sum the numbers 5,10,15,etc. upto 1000 and add it to the first sum then sum the numbers 15,30,45,etc. up to 1000 and subtract it from the previous sum as you don't want to count multiples of 3 AND 5 twice.
Michael,
how many primes you've found before reaching 150.000.000? (I think, 8.9xx.xxx)
I agree with Francis. The total number of primes (including 1) is 8,444,397 and it takes about 10 seconds to extract them on the my "modestly powered computer".
Francis,
since "an efficient implementation will allow a solution to be obtained on a modestly powered computer in less than one minute." then you need to gain by a factor of about 50,000 to come close to succeeding.
I can see some savings in the method being used but nothing of that order.
I think to start with you need a much more efficient IsPrime() function and a more efficient find next prime function.
Paul.