|if OP wants an array to store his primes then by god he can use an array :)|
haha, very funny.
a good programmer shall always look for the best algorithm possible, if you can save 40KB, that's good.
|As you said, it's only 40KB. It's not 1970 anymore ;)|
if you go around wasting kilobytes for no good reason your program might easily reach several hundred megabytes where it could be just a few kilobytes big.
i thank you for your friendliness in talking, it's delightful.
you are right, i didn't read all the code, and this is my bad.
after reading it:
the algorithm trades 40KB of memory space with several hundred thousand CPU operations.
i admit this algorithm is better than mine.
i'm hoping to see a yet better algorithm, oh i know it:
go to wolframalpha.com and type:
it will give you the answer in microseconds. :P