Please see:
http://www.experts-exchange.com/Programming/Programming_Languages/C/Q_22033872.html
If you dont read that this question will not make sense.
What I was thinking now is that since even numbers are never prime anyway, why not leave them out and allow me to fit 64 numbers in a 32bit long..
For example, i will do 8bit for this example starting at 1:
1111 0110 -> Where each bit corresponds to 1, 3, 5, 7, 9, 11, 13, 15.
Where if I was including the even numbers I would have:
1010 1010 0010 1000, which is 16bits
So by this method I should be able to cut the required memory in half...I'm basically trying to have a list of all prime number between 1 - 10,000,000 with fastest searchtime and smallest amount of memory.
Any thoughts?
Makes good sense ... good thinking. Even computation would be simple .. if num%2 == 0 skip it else find if it is prime and set num/2th bit
Cheers!
sunnycoder